How to stop the browser loading process after 20 minutes?
emmalee last edited by user
I want to stop the browser loading process after 20 minutes in selenium webdriver script.
Please suggest, how to do this?
How to do it? Set some form of timer with an expiration of 20 minutes (either a selenium wait for one of the objects on the page if you want to be able to continue if it does load, or a thread.sleep if you literally want to sleep exactly 20 minutes and then quit). At the expiration of the timer, if it was a selenium wait, put your driver.close in the cleanup method; if it was a thread.sleep, call driver.close directly after.
But why? If your page isn't loading or is hanging, 20 minutes is a ridiculously long timeout. Will your customers wait 20 minutes on the page? Or will they give up after 30 seconds or so? And furthermore, why is your page hanging for over 20 minutes in the first place? What test case requires staring at a blank screen for 20 minutes then closing the browser? Are you sure it's an appropriate test case in the first place? If the test is "The page loads successfully", I suggest that 20 minutes is far, far too long.