Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium IDE for Firefox Ctrl-Tab

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.

like image 340
michael Reid Avatar asked Jan 14 '23 09:01

michael Reid


1 Answers

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()

like image 74
Petr Janeček Avatar answered Jan 31 '23 10:01

Petr Janeček