Reputation: 2057
I have a ruby script that opens a browser. I have it set to open Firefox first and then Chrome if FF fails for some reason - like FF gets updated and Selenium hasn't caught up yet.
The wait function/definition works fine for FF but always breaks Chrome. Here is the relevant code for the Chrome browser startup:
b = Selenium::WebDriver.for :chrome
b.driver.manage.timeouts.implicit_wait = $BROWSER_IMPLICIT_WAIT
I'm fairly new to Selenium still and I user the wait.until command after declaring something like:
wait = Selenium::WebDriver::Wait.new(:timeout => $BROWSER_EXPLICIT_WAIT)
The above lines of code work fine in Firefox. However, I'd like to run my scripts with both FF and Chrome. Is there a way to do this in Chrome and FF?
Thanks
Upvotes: 2
Views: 1223
Reputation: 8548
See now that you provide the error it gets easier to solve.
The reason is that - you have named the selenium driver instance as b
but defining the implicit time as
b.driver.manage.timeouts.implicit_wait = $BROWSER_IMPLICIT_WAIT
ie with b.DRIVER
, hence the error message - undefined method 'driver' for
change your command to
b.manage.timeouts.implicit_wait = $BROWSER_IMPLICIT_WAIT
Upvotes: 1