Need to get an xpath expression for the span inside the iframe. Need Help in getting XPath expression for span inside an Iframe popup.
i can get the iframe but getti
We can't access elements within an iframe directly. We need to switch to iframe first.
I am using PHP Facebook webdriver and this is perfectly working for me:
$driver->get("http://www.example.com"); // containing an iframe
$iFrame = $driver->findElement(
WebDriverBy::xpath('//iframe[@name="iFrameName"]') //name or id or whatever by which we can access.
);
$driver->switchTo()->frame($iFrame);
Now, we can access that span as:
$spanButton = $driver->findElement(
WebDriverBy::xpath('//span')
);