How can I reconnect to the browser opened by webdriver with selenium?


For some unknown reasons ,my browser open test pages of my remote server very slowly. So I am thinking if I can reconnect to the browser after quitting the script but don’t execute webdriver.quit() this will leave the browser opened. It is probably kind of HOOK or webdriver handle.
I have looked up the selenium API doc but didn’t find any function.
I’m using Chrome 62,x64,windows 7,selenium 3.8.0.
I’ll be very appreciated whether the question can be solved or not.

  • You must to post comments

No, you can’t reconnect to the previous Web Browser session after quiting the script. Even if you are able to extract the Session ID, Cookies and other session attributes from the previous Browsing Session still you won’t be able to pass those attributes as a HOOK to the WebDriver.

A cleaner way would be to call webdriver.quit() and then span a new Browsing Session.

History :

Previously there had been some discussions and attempts to reconnect WebDriver to an existing running browsing session. You can find the discussions in these QA :

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.