RSelenium: server signals port is already in use

后端 未结 5 813
北恋
北恋 2020-12-14 08:42

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

5条回答
  •  时光取名叫无心
    2020-12-14 09:06

    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))
    

提交回复
热议问题