I have a number of page elements that I want to store in a variable and loop through using Selenium Webdriver PHP.
For example:
< cite > Name 1 < /cite >
< cite > Name 2 < /cite >
<cite > Name 3< /cite >
I am using the following code, but it doest give me the results from above(i.e. Name 1) etc. How do I grab the text from the element using Selenium Webdriver.
$users = $driver->findElements(
WebDriverBy::xpath('//cite')
)->getText();
foreach($users as $u)
{
echo $u;
}
I am using Selenium Webdriver Facebook wrapper
findElements()you need to usefindElement()to accessgetText()