Reputation: 7203
<iframe width="100%" scrolling="yes" height="100%" frameborder="0" src="/detail.aspx=" name="displayIFrame"></iframe>
<html>
<head>
<frameset framespacing="1" onload="ScrollToAnchor('text', 'Docln', false); if (document.all) {var h = doccontext.document.all.docContextContentDiv.offsetHeight; document.body.rows = h + ',*,22';}" rows="95,*,22" >
<frame scrolling="no" title="Heading frame" src="head.aspx" name="head"></frame>
<frame scrolling="yes" title="Content frame" src="content.aspx" name="text"></frame>
<frame scrolling="no" title="Footer frame" src="footer.aspx" name="footer"></frame>
</frameset>
I have something like:
Selenium.SelectFrame("displayIFrame");
Selenium.SelectFrame("head");
Selenium.SelectFrame("text"); // I get "ERROR: Not a frame: text"
Why am I getting ERROR: Not a frame: text From the html code above, "text" is the name of the frame I'm trying to select. Seems like I'm doing everything right. Please help me out.
Upvotes: 3
Views: 2281
Reputation: 151
You could try selecting the top frame before selecting the others, like this:
Selenium.SelectFrame("relative=top");
Selenium.SelectFrame("head");
Selenium.SelectFrame("relative=top");
Selenium.SelectFrame("text");
Upvotes: 6
Reputation: 2949
According to the reference you can call this multiple times to select nested frames. However, "head" and "text" are not nested, but they are siblings. I think you can either select the "head" frame like this:
Selenium.SelectFrame("displayIFrame");
Selenium.SelectFrame("head");
or select the "text" frame like this:
Selenium.SelectFrame("displayIFrame");
Selenium.SelectFrame("text");
If you have to switch from "head" to "text" in your scenario try this:
Selenium.SelectFrame("displayIFrame");
Selenium.SelectFrame("head");
//do something
Selenium.SelectFrame("relative=parent");
Selenium.SelectFrame("text");
//do something
Upvotes: 4