Juhan Juhan - 4 months ago 6x
Java Question

How to traverse through different frames inside an iFrame?

I have a iframe given below, I can traverse to iframe, but can't perform any operations like traverse or click on other components or frames inside the frameset.
How do I click the frames/elements inside the frameset?

<iframe id="selector_window" name="selector_window" src="/webadmin/webeditor/selectormanager_wcm.jsp? width="750" height="450">
<meta http-equiv="pragma" content="no-cache">
<frameset rows="*,100" border="1" bordercolor="Gray">
<frameset cols="200,200,200" border="1" bordercolor="Gray">
<frame name="selectorlistfilter" src="blank.html" frameborder="1">
<frame name="selectorlist" src="blank.html" frameborder="1">
<frame name="selectorpreview" src="blank.html" frameborder="1">
<frame name="selectorinsert" src="blank.html" marginwidth="2" marginheight="2" frameborder="0">


switch to any frame element , just use driver.switchTo().frame("framename");

Once we switched to one frame, if we need to switch to another frame, we have to switch to the parent frame.For that use


If you use driver.switchTo().defaultContent();, it may not work. so go for driver.switchTo().parentFrame();, it works fine.