I\'m using the following code in RSelenium to open a browser. After I close the browser, or even close the handler by running remDr$close(), the port is still in use. I have
The command:
system("taskkill /im java.exe /f", intern=FALSE, ignore.stdout=FALSE)
will free all the ports.
If you want to free a particular port, you can do this:
#get the PID of the process you launched
pid <- driver$server$process$get_pid()
#pasting this PID in the following command (will kill all the child processes as well, closes the browser as well)
system(paste0("Taskkill /F /T" ," /PID ", pid))