I have created Ruby test script that use Selenium RC to test my web app directly in 2 browsers(IE, Firefox). My script runs - first on IE then continue on firefox and then should be continued and finished in already opened IE browser. My problem is: I can't continue(reconnect) to run my script in already opened IE browser. I use @browser = RSpecSeleniumHelper.connect_browser("URL") but it opens with new session(it needs to keep previous session).
A:
Is there a particular reason you need to switch between browsers half way through?
I have no idea how you'd fix the problem, but it seems like it would be best solved by running the tests in one browser at a time.
Jon Wood
2009-01-14 13:03:37
A:
I'm also unsure why you need to switch back and forth in your browsers.
Regardless, I'm doing something similar, but instead I use a different library. I'm using the "Selenium" gem. (gem install selenium) and here's what I would do in your situation.
@ie_driver = Selenium::SeleniumDriver.new(rc_host, port, "*iexplore", url, 1000)
@ie_driver.start
@ie_driver.whatever //Test code
@ff_driver = Selenium::SeleniumDriver.new(rc_host, port, "*firefox", url, 1000)
@ff_driver.start
@ff_driver.whatever //Test code
@ff_driver.stop
@ie_driver.whatever //Continue test code with IE
@ie_driver.stop
In summary, while I'm not really familiar with your selenium library, typically I would create 2 instances of the R/C driver, that way I won't have to interrupt the session.