How to end process 'chrome.exe' at the end of script execution

1

I've implemented a script using selenium that accesses a few pages. The code is working exactly as expected.

My problem is when script ends its execution which happens in two ways:

  • When the user closes the browser (ChromeDriver)
  • When the user closes the command prompt or interrupts the script (Ctrl + C)

After the execution is terminated, the 'chrome.exe' process remains active, causing files to continue being used and locked (can not delete / move) / rename ...).

I discovered that there are commands to terminate these processes.

browser.close() will close only the current window.

browser.quit() closes all open windows.

But I need to trigger these methods at the right times, to have triggers that trigger only when the user finishes running.

Any other idea / solution is welcome.

    
asked by anonymous 28.02.2018 / 18:59

0 answers