Difference between selenium.selectFrame() and selenium.selectWindow()

僤鯓⒐⒋嵵緔 提交于 2019-12-08 13:52:27

问题


I've been struggling with the difference between the following commands, used while accessing widgets contained within iframes:

selenium.selectFrame("widget0");

selenium.selectWindow("name=widget0");

In the past (prior to IDE v1.0.12), I have been using these interchangeably, preferring the former over the latter in most cases. However, with 1.0.12, swapping them out after recording does not work. In what cases would each one be used?

Thanks.


回答1:


selectFrame is the API of selenium to select a particular frame form HTML source. Say, some HTML elements are present inside a iframe of HTML source, therefore u are not able to take event on those elements until to use selectFrame API.

selectWindow will be used in those cases where after take some event a new browser popup window open and u need to take action on the popup window instead of main browser page. After doing ur operation u need to select back ur main browser window.



来源:https://stackoverflow.com/questions/6654106/difference-between-selenium-selectframe-and-selenium-selectwindow

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