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
No, you can't reconnect to the previous Web Browsing Session after you quit the script. Even if you are able to extract the Session ID
, Cookies
and other session attributes from the previous Browsing Context 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 Context.
There had been a lot of discussions and attempts around to reconnect WebDriver to an existing running Browsing Context. In the discussion Allow webdriver to attach to a running browser Simon Stewart [Creator WebDriver] clearly mentioned:
- Reconnecting to an existing Browsing Context is a browser specific feature, hence can't be implemented in a generic way.
- With internet-explorer, it's possible to iterate over the open windows in the OS and find the right IE process to attach to.
- firefox and google-chrome needs to be started in a specific mode and configuration, which effectively means that just attaching to a running instance isn't technically possible.
webdriver.firefox.useExisting not implemented