-1

I know you can use driver.quit() and driver.close() but how to close nicely when executed multiple processes?

IDEAS:

  • Use process ID?
MR Sample
  • 25
  • 6

1 Answers1

0

Using Selenium to end the WebDriver and Web Browser session graciously you should invoke the quit() method within the tearDown() {}. Invoking quit() deletes the current browsing session through sending quit command with {"flags":["eForceQuit"]} and finally sends the GET request on /shutdown endpoint. Here is the relevant log:

1503397488598   webdriver::server   DEBUG   -> DELETE /session/8e457516-3335-4d3b-9140-53fb52aa8b74 
1503397488607   geckodriver::marionette TRACE   -> 37:[0,4,"quit",{"flags":["eForceQuit"]}]
1503397488821   webdriver::server   DEBUG   -> GET /shutdown

So on invoking quit() method the Web Browser session and the WebDriver instance gets killed completely.

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352