Reputation: 1917
What is the proper way to convert a WebElement to an int? Is this even possible?
Upvotes: 1
Views: 10809
Reputation: 10329
This is a java problem, not a Selenium problem. You can use:
driver.findElement(By...locator).getText().toInteger() // this works in Groovy only
or you can use
Integer.parseInt(driver.findElement(By...locator).getText()); // this works in Java or Groovy
Upvotes: 3