On using WebUI.closeBroswer(),
It only close browser, but chromeDriver,exe is still running on my machine. how to exit the chromeDriver.exe
On using WebUI.closeBroswer(),
It only close browser, but chromeDriver,exe is still running on my machine. how to exit the chromeDriver.exe
Hi there,
My chromedriver.exe is terminated when I call ‘Close Browser’ step. Please double check again if your browser is closed completely or not, or there are multiple chromedriver instances on your side
If you want to terminate chromedriver.exe anytime after execution, you can check on ‘Terminate Drivers’ option from Project -> Settings -> Execution
Thanks
Edited: @Russ_Thomas
Same here, after running many testcases, I have a large numbers of chromedrivers.exe still running. I use WebUI.closeBrowser() and it does close the browser, but let the driver run.
Manual work-around:
Create a batch file with the following contents:
taskkill /f /im chromedriver.exe
pause
Create a custom keyword as below and call it either at end or at the beginning of the test case.
This will kill all instances of chrome.exe and chrome driver.exe
public class killProcess{
@Keyword
def killProcess() {
Runtime.getRuntime().exec(“taskkill /im chromedriver.exe /f”)
Runtime.getRuntime().exec(“taskkill /im chrome.exe /f”)
}
}
Getting errors when using this Keyword.
Which imports / includes need to be added?
Personally, I prefer to keep this kind of thing out of my tests. I have a batch script which I run when needed. It contains just three lines, one for each webdriver module:
taskkill /f /im geckodriver.exe
taskkill /f /im chromedriver.exe
taskkill /f /im IEDriverServer.exe
Hi Russ,
Thanks for your feed-back.
I use a similar batch script as well. I don’t always remember to run the script so I was thinking it might be good to add a keyword to kill the driver(s) when I call my single logoff case.
Also I use Windows Scheduler to run cases over-night so having the killProcess will help for that testing.
Cheers,
Dave
Found the solution (I had to use single quotes):
public class killProcess {
@Keyword
def KILLWebdriver() {
Runtime.getRuntime().exec(‘taskkill /f /im chrome.exe’)
Runtime.getRuntime().exec(‘taskkill /f /im chromedriver.exe’)
Runtime.getRuntime().exec(‘taskkill /f /im geckodriver.exe’)
Runtime.getRuntime().exec(‘taskkill /f /im IEDriverServer.exe’)
Runtime.getRuntime().exec(‘taskkill /f /im firefox.exe’)
}
}