Selenium IDE for Firefox Ctrl-Tab

て烟熏妆下的殇ゞ 提交于 2019-11-26 22:04:52

问题


I'm attempting to automate some settings in multiple forms from a list that I open into their own tabs. The easiest way that I can prep the pages prior to running the script is to have them all open . I intend to have selenium run through the changes to the form, then I want it to Ctrl+Tab to the next one. I will use a loop while to set the count. I currently have it recording in HTML, if I need to adjust it over to java or I will gladly do so.

I've attempted to record it, but no go.


回答1:


There's no support for tabs in Selenium as of now. A fairly recent answer by one of the Selenium developers explains it pretty clearly:

Selenium has no ability to switch tabs at the moment. Because of this we force the browser to open links in new windows but since we are able to switch windows we force the browser to take the approach. This may be fixed in a later version.

Also, if you get away from IDE (or export your testcase to WebDriver) and get to a more powerful tool (any full-strength programming language binding for Selenium), you might use some kind of workaround:

https://stackoverflow.com/a/12730918/1273080 (Taps Ctrl+2 to get to the second tab etc.) However, this kind of workarounds is usually limited to a certain browser/OS/browser setting (tabs can be disabled).


That said, if you don't insist on using tabs and would use several browser windows instead, that's fairly easy in IDE as well as Selenium RC and WebDriver:

Selenium IDE: selectWindow (you can spawn a new window by openWindow)

Selenium RC: selectWindow()

Selenium WebDriver: switchTo().window()



来源:https://stackoverflow.com/questions/14550360/selenium-ide-for-firefox-ctrl-tab

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