I can write Xpath with or without Firebug/ Firepath but it would be great if there is work around to write Xpath with iframe using these third party tool.
First I need to move to iframe then write regular Xpath for webElements
Asked
Active
Viewed 89 times
1 Answers
1
use xpath to find the iframe. then use getattribute() to get the src. then navigate to the src.
for example:
var myFrame = driver.FindElement("descendant::iframe[@name='TheIFrame']");
string frameSrc = myFrame.GetAttribute("src");
driver.Navigate().GoToUrl(frameSrc);
//now you're on the frame and interact with its DOM
If you don't want to navigate away from the page you're on, you have a few otions:
1) Create a new driver and navigate there
2) use httpclient (less overhead than the driver) to get the content by sending a get to the src url, then use HTMLAgilityPack to load it into an HTMLDoc you can navigate with XPath - of course this will let you scrape data but you won't be able to click buttons or interact with javascript.

chris-crush-code
- 1,114
- 2
- 8
- 17
-
Please see above picture, I appreciate your comment but your answer is not my expectation. I want to use specifically Firepath for iframes – Mike ASP Nov 18 '17 at 02:37
-
You may want to fix your tags so that right people see your question. Your question seems to be about firebug & xpath rather than C# and Selenium. – chris-crush-code Nov 18 '17 at 14:42