This is the HTML file I have. I am trying to use Selenium-Webdriver API along with ChromeDriver to send_keys
to an input
filed inside the <body>
. But I can't access anything which is inside of #document
. I cannot figure out why. Can someone please tell me what this #document
means and how can I access any of the elements inside this using Selenium .
<html>
<head>…<head>
<frameset >
<frame>...</frame>
<frame name="mainFrame" src>
#document
<html>
<head>…</head>
<body>…</body>
</html>
</frame>
</frameset>
</frameset>
This is a router webpage, the actual webpage is HUGE, so I haven't pasted it here.
Just to summarize on what I learnt and implemented.
If you have mulitple frames/framesets, you will have to switch frames.
a. so first get to the default content. driver.switch_to_default_content()
b. then get to the frame that you want to work with. frame = driver.find_element_by_name('mainFrame')
I have tried to do the same process in C#, and this worked for me. (I leave the code here for someone who maybe is looking at this in C#). I hope this will be useful for someone!
var FrameName = driver.FindElement(By.Name("...Frame Name..."));
driver.SwitchTo().Frame(FrameName);
var elem = driver.FindElement(By.XPath("... Xpath from in of the
Frame..."));
elem.Click();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.