How do I convert Selenium web element to string?
To find my element, I used:
String text = driver.findelement(By.xpath("xyz"));
But it throws an error of type casting. I tried to use the code below to cast the element to a string:
This gave me an error that the cast would not work.
How do I get convert the web element to a string?
String text = driver.findElement(By.xpath("xyz")).getText();