How to traverse through different frames inside an iFrame?

﹥>﹥吖頭↗ 提交于 2019-12-04 10:57:27

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

driver.switchTo().parentFrame();

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

In selenium always follow the sequence. From parent->child1->child2 and again 
Webdriver parent = driver.switchTo().frame(0);
Webdriver child1 = driver.switchTo().frame(1);
Webdriver child2= driver.switchTo().frame(2);
going back to parent 

driver.switchTo().frame(1)
driver.switchTo().defaultcontent();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!