Watir script occasionally returning Net::ReadTimeout error
The above error was thrown when the page load time exceeds for 60 seconds so write the following code for page load
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 120 # seconds
driver = Selenium::WebDriver.for :firefox,http_client: client
b=Watir::Browser.new driver
b.goto "www.google.com"
Now your code would wait for 120 seconds for any page load which has been caused by #click
and also wait to load the url
by goto
method.
Ruby Watir WebDriver Net::ReadTimeout
I've been getting this error for some websites quite a lot after I try to, eg, browser.button.click
that is redirecting to another page heavily loaded with Ajax. I found this:
browser.execute_script('document.getElementsByTag('button')[0].click()')
sleep 10
with adjusted sleep (or, much better, .wait_until_present
) helps.
Related Topics
Getting a Rogue Iteration from My .Each Loop
Instance_Eval Does Not Work with Do/End Block, Only with {}-Blocks
How to Build a Docker Image for a Ruby Project Without Build Tools
Errno::Enoent No Such File or Directory Rails 4
Ruby Parenthesis Syntax Exception with I++ ++I
Rvm Isnt Setting Environment with Cron
Ruby: Automatically Wrapping Methods in Event Triggers
Ruby Facebook Graph API Appsecret_Proof
How to Understand the #Dup and #Clone Operate on Objects Which Referencing Other Objects
Rails 404 Error for Stylesheet or JavaScript Files
Calling Instance Variables Without @
Stubbing Controller Actions in Rspec Request Specs
Initialize the Delayed Jobs Gem by Starting the Workers on Application Start
How to Send Custom Invitation Using Devise_Invitable
Update Field Through Link_To in Rails
Using Poltergeist with a Proxy