Kill chromedriver process in Selenium / Java -
i running multiple java programs through jenkins using "build periodically" option , uses h 06 * * 1-5 (run every day between 6 , 7 monday friday).
there programs in click on links opens new window. hence, use below code
driver.findelement(by.xpath(".//*[@id='terms']/li[1]/a")).click(); system.out.println("home page loaded , terms of use link clicked"); arraylist<string> window1 = new arraylist<string>(driver.getwindowhandles()); driver.switchto().window(window1.get(1)); thread.sleep(3000); driver.close(); thread.sleep(3000); driver.switchto().window(window1.get(0));
now after program runs, other program following fails because of chromedriver.exe process running.
i tried using driver.quit()
instead of driver.close()
in code above, close entire browser.
note: have used driver.quit()
@ end of program doesn't me getting rid of running chromedriver.exe instance opened when switched window.
please suggest me a way handle issue. have been looking solution in java. see answers c#.
thanks
the root cause in other place. such issues happen in case of unexpected exceptions thrown, prevent framework quitting session cleanly.
as can't see entire picture of how you're managing webdriver sessions, it'll guessing game.
driver killed via command line, e.g. taskkill
(or whatever os you're using), executed via e.g. https://github.com/zeroturnaround/zt-exec library. it'd workaround, hide potential weakness of architecture.
Comments
Post a Comment