I am writing a program in Selenium using Java. In my code, I have:
driver = new FirefoxDriver();
My problem is this: if I am not connected to the internet when the program executes this line of code, the program will hang for a long time (on the order of minutes) before finally opening up a Firefox Window and then crashing on the next line of code
driver.doWhatever();
I am trying to make this as user friendly as possible, so I would love to have my program exit if
driver = new FirefoxDriver();
does not complete within fifteen to twenty seconds.
Is there a way to do this in Java? I could always go into Selenium and tinker with it so that it works the way I want it to, but that seems like the "wrong" way to go about solving this problem.
Thanks in advance.