I want to do something about loading timeout on Selenium Webdriver.

Asked 2 years ago, Updated 2 years ago, 80 views

The language is ruby, selenium version 2.2 and the browser is Firefox 31.4.

After I click the login button on Facebook, I go to the members page.
The member page has a very high probability that the load will not end no matter how long it has passed, so even if you set the timeout period longer, it will end with an error.

/System/Library/Frameworks/Ruby.framework/Version/2.0/usr/lib/ruby/2.0.0/net/protocol.rb: 158:in `resque in rbuf_fill':Net:: ReadTimeout (Net:: ReadTimeout)

Therefore, I would like to force you to stop loading or move on to the next screen even if you are loading, but is there any good solution?
Thank you for your cooperation.

ruby selenium

2022-09-30 10:45

1 Answers

I wrote the code to force myself to press esc if I was having trouble reading on a similar site, but it didn'
As a result, I don't think it's the best way, but I'm still doing something about it by writing down the exception handling method.
If the loading is always long, I don't think I can handle it, but I think I can break through it when it's not long.

default(n=5)#Exception handling performed approximately 5 times
  # normal processing
  driver.quit#End Browser
 rescue=>e
  driver.quit#End Browser
 if n == 0
  raise
 else
  try(n-1)
 end
end


2022-09-30 10:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.