3

How do I tell selenium webdriver to retry/timeout when I start a session?

  1. I'm spinning up a remote standalone java server (aka hub) as a process
  2. I'm immediately going webdriver.Remote() and that sometimes times out/refuses conn

My suspicion is that either the socket cannot connect because the selenium server is still starting itself on the other end, or, less likely the local end is still resolving the remote ip from it's name. It's just striking that the driver does not let a person specify a timeout to cater for when the remote is still starting. Obviously if my network performance is poor, then it's going to cause me other pains, but if the remote end is a machine with a slow hard-drive, I'd want to fix that. I really hope it's something in my environment which is a farm of machines many of them VM's hence my assumption it's resource contention or just the java server taking time to start fully. I'm using Python bindings, here is the prototype:

def __init__(self, command_executor='http://127.0.0.1:4444/wd/hub',
             desired_capabilities=None, browser_profile=None, proxy=None,
             keep_alive=False, file_detector=None, options=None):

I'm possibly asking this question Selenium Chrome Driver - Can i set timeout for connecting to driver? but not convinced.

As a workaround I'm adding a simple HTTP get to try and wait for the web console to be responding with a 200. Which seems cleaner to me than calling webdriver.Remote() a second time. Any better advice?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.