FuckTheWorld / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Chromedriver quit() method doesn't close all chrome.exe processes #1135

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
Chromedriver quit() method doesn't close all chrome.exe processes. 
Environment:
java 1.8.0_45
OS Win 7
chrome driver v2.15
chrome 43.0.2357.124 m

Steps to reproduce:
1. Execute the following code to navigate to google page
ChromeOptions options = new ChromeOptions();
options.addArguments("no-sandbox");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
driver.quit();

ACTUAL RESULT
Chrome window is closed
Go to task bar and see that chrome.exe is still running

EXPECTED RESULT:
All chrome processes initiated by chromedriver have to be closed after calling 
quit() method.

Original issue reported on code.google.com by abu...@thunderhead.com on 23 Jun 2015 at 1:01

GoogleCodeExporter commented 9 years ago
"Task manager" not a "task bar" in the second sentence of ACTUAL RESULT sections

Original comment by abu...@thunderhead.com on 23 Jun 2015 at 1:18

GoogleCodeExporter commented 9 years ago
Have you tried this ?

ChromeOptions options = new ChromeOptions();
options.addArguments("no-sandbox");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
driver.close();
driver.quit();

this will close all the chrome.exe plus chromedriver.exe

=============
Close() - used to close the browser or page currently which is having the focus.
Quit() -  used to shut down the web driver instance or destroy the web driver 
instance(Close all the windows).

Original comment by agau...@chromium.org on 24 Jun 2015 at 9:35

GoogleCodeExporter commented 9 years ago
I have reported this issue for the quit function. It actually closes the 
windows but doesn't stop the process chrome.exe. In the beginning of test it 
runs the chromedrive then chrome. We see 5 processes chrome.exe in the memory. 
After calling quit() chromedriver process stops, 4 chrome.exe processes stop 
also but one chrome.exe remains in memory. This is the issue.

Workaround provided by works fine, but unfortunately we cannot use it because 
in our case jbehave calls quit() method.

Original comment by abu...@thunderhead.com on 25 Jun 2015 at 7:17

hyukkyulee commented 6 years ago

The problem is the signal not properly going through. PhantomJS has similar problem. But, geckodriver(firefox) does not. Here is the alternative fix for chromedriver.

import signal
driver.service.process.send_signal(signal.SIGTERM)  # kill the specific child proc
driver.quit()

this works perfectly