Browser.Driver.quit() doesn't close the driver process instance.

1,351 views
Skip to first unread message

owens...@hotmail.com

unread,
Sep 1, 2016, 12:22:14 PM9/1/16
to PrimaTest Automation
When I close the browser at the end of a action or testcase, the driver process is still running. It doesn't matter if it is the chromedriver or IEdriver.

I changed the CloseBrowser from:
if(Browser.Driver) Browser.Driver.close()
to:
if(Browser.Driver) Browser.Driver.quit()

This has no effect.
If I write a custom C# in visual studios and copies it over to the same node and run it by itself, the driver.quit() closes the browser and kills the driver process.

Is this because the agent is still holding onto the process and not closing it? I looked at the process table and there was 54 chromedriver/IEdrivers running.

Thanks

mode...@hotmail.com

unread,
Sep 6, 2016, 10:29:11 AM9/6/16
to PrimaTest Automation, owens...@hotmail.com
I have updated and tried multiple drivers with the same issue, Driver.Quit() within RWHQ is not closing the process. any other use of the driver through C# and RobotFrame work closes the process on quit.

Does anyone know how I can kill this short of writing a C# or python script to do this after I execute the quit(). This seems heavy handed but may be needed if I can not get RWHQ to do it.
thanks for any help.

mariusz....@gmail.com

unread,
Sep 8, 2016, 3:26:42 PM9/8/16
to PrimaTest Automation
Hi,

you need to call service.stop() for drivers that use the chromedriver.exe or eidriver.exe

I would suggest you modify Browser.groover
add a field:
public static def Service=null

and store the service variable initialised when browser type is chrome or IE

Then in CloseBrowser.groovy you'll need to call Browser.service.stop() if it isn't null.

Also, driver.quit() is the right method to call. Because driver.close() only closes the current window and wont work if you have a popup opened.

Good luck

owens...@hotmail.com

unread,
Sep 9, 2016, 12:34:31 PM9/9/16
to PrimaTest Automation, mariusz....@gmail.com
Thanks,
It is almost working.
I added the following to Browser.groovy:
public static Service = null
.
.
.
Service = service

Then in CloseBrowser.groovy I have the following:
if(Browser.Driver) Browser.Driver.close()
if(Browser.Driver) Browser.Driver.quit()
if(Browser.Service) Browser.Service.stop()

It now closes and exits the service, but I am getting an exception with Service.stop()
Process refused to die after 10 seconds, and couldn't taskkill it: Unable to find executable for: taskkill


STDOUT ERROR: Sep 09, 2016 9:32:38 AM org.openqa.selenium.os.ProcessUtils killWinProcess WARNING: Process refused to die after 10 seconds, and couldn't taskkill it java.lang.NullPointerException: Unable to find executable for: taskkill at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:251) at org.openqa.selenium.os.UnixProcess.<init>(UnixProcess.java:62) at org.openqa.selenium.os.CommandLine.<init>(CommandLine.java:38) at org.openqa.selenium.os.WindowsUtils.killPID(WindowsUtils.java:178) at org.openqa.selenium.os.ProcessUtils.killWinProcess(ProcessUtils.java:137) at org.openqa.selenium.os.ProcessUtils.killProcess(ProcessUtils.java:81) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.destroyHarder(UnixProcess.java:247) at org.openqa.selenium.os.UnixProcess$SeleniumWatchDog.access$200(UnixProcess.java:201) at org.openqa.selenium.os.UnixProcess.destroy(UnixProcess.java:125) at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:155) at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:196) at org.openqa.selenium.remote.service.DriverService$stop.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112) at actions.selenium.CloseBrowser.run(CloseBrowser.groovy:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:848) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:831) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:164) at redwood.launcher.Launcher.runAction(Launcher.groovy:159) at redwood.launcher.Launcher$runAction.callStatic(Unknown Source) at redwood.launcher.Launcher$_main_closure1_closure6_closure7.doCall(Launcher.groovy:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at groovy.lang.Closure.call(Closure.java:411) at groovy.lang.Closure.call(Closure.java:427) at org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForLine(DefaultGroovyMethods.java:3883) at org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:463) at org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:416) at org.codehaus.groovy.runtime.IOGroovyMethods.eachLine(IOGroovyMethods.java:400) at org.codehaus.groovy.runtime.dgm$654.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at redwood.launcher.Launcher$_main_closure1_closure6.doCall(Launcher.groovy:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at groovy.lang.Closure.call(Closure.java:411) at org.codehaus.groovy.runtime.SocketGroovyMethods.withStreams(SocketGroovyMethods.java:60) at org.codehaus.groovy.runtime.dgm$868.invoke(Unknown Source) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at redwood.launcher.Launcher$_main_closure1.doCall(Launcher.groovy:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) at groovy.lang.Closure.call(Closure.java:411) at groovy.lang.Closure.call(Closure.java:427) at org.codehaus.groovy.runtime.SocketGroovyMethods.invokeClosureWithSocket(SocketGroovyMethods.java:189) at org.codehaus.groovy.runtime.SocketGroovyMethods.access$000(SocketGroovyMethods.java:42) at org.codehaus.groovy.runtime.SocketGroovyMethods$1.run(SocketGroovyMethods.java:178) at java.lang.Thread.run(Thread.java:745)

any ideas what I am missing?


Freddy Vega

unread,
Sep 9, 2016, 1:26:38 PM9/9/16
to PrimaTest Automation, mariusz....@gmail.com, owens...@hotmail.com
is the directory where taskkill lives in your path? Should be Windows\System32

owens...@hotmail.com

unread,
Sep 9, 2016, 1:49:23 PM9/9/16
to PrimaTest Automation, owens...@hotmail.com
Ya, that was the first thing I checked since it could not find taskkill. I also ran path from the CLI C:\windows\system32 was there and I can run taskkill from the CLI.

That is what is puzzling me.

mariusz....@gmail.com

unread,
Sep 9, 2016, 1:57:32 PM9/9/16
to PrimaTest Automation
looks like its the same error as this post: https://groups.google.com/forum/m/#!topic/primatest-automation/prhCOSIVEuo
But this is fixed in version 2.4, perhaps your agent is not up to date?

owens...@hotmail.com

unread,
Sep 9, 2016, 2:12:30 PM9/9/16
to PrimaTest Automation, mariusz....@gmail.com
This is from my agents properties.conf file:

[Agent]
AgentVersion=2.40.20
AgentPort=5009
AgentVNCPort=3006
Update=
OS=Windows


Looks like I have 2.40

mariusz....@gmail.com

unread,
Sep 12, 2016, 10:40:05 AM9/12/16
to PrimaTest Automation
I think the fix in the post I sent earlier was only corrected for java type projects

Look in your Agent files
agent\routes\command.js

process.env is only included in path for Java type projects.

It should be included for all types.

Good luck

owens...@hotmail.com

unread,
Sep 13, 2016, 8:59:25 AM9/13/16
to PrimaTest Automation, mariusz....@gmail.com
OK.
Right now I am just catching the exception so it isn't failing anything. It is just leaving a nasty exception in my log files. Is this something that will be fixed?

Vikas Parushetti

unread,
Feb 3, 2018, 1:02:43 AM2/3/18
to PrimaTest Automation
Is this got fixed in latest build or do we need to modify any config files in the system

Thanks
Vikad

Reply all
Reply to author
Forward
0 new messages