Some days ago, I was running my regression automation suite and found webdriver is not able to launch browser. I was getting some socket exception. Whenever I face such situation, I just try to update browser version, browser driver version and selenium jar file version. Versioning non-compatibility is major issue in Selenium for not launching browser or URL.
When I downloaded “chromedriver.exe” and tried to replace with old one in folder. It was giving me exception that it can not be deleted as it is in use. But I was not running any scripts. I opened task manager and see there are so many instance which are up and running.
This is because we need to set a system property to launch any browser. Statement is as below:
Because of above statement, system launches new executable file for each program run keeping older executable files in memory. It can reduce your system performance drastically.
So, it is good idea to terminate the execution of executable files once you are done. Now we will see how can we do that. We need to use below statement to kill executable file:
Runtime.getRuntime().exec(“taskkill /F /IM chromedriver.exe”);
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.