0

I'm trying to run a simple RSelenium script to scrape the web, but I'm getting an error Selenium server signals port = 4567 is already in use. Steps:

First I start the driver in the terminal: $ docker run -d -p 4567:4444 selenium/standalone-chrome

I can see it's up and running with docker ps

In RStudio I try running:

library(RSelenium)
remDrAll <- rsDriver(port = 4567L, browser = "chrome")

but I get an error that says the port is already in use (described above). I've ran this 1000s of times and I was just running the same code a day ago and it was working just fine.

When I run $ lsof -nP -i4TCP:$PORT | grep LISTEN there's nothing out of the ordinary.

I'm sorry I can't give reproducible code, but I'm at a loss here. Can anyone help me figure out why I can't connect?

CoolGuyHasChillDay
  • 659
  • 1
  • 6
  • 21

1 Answers1

0

Have you tried the approach described here? It mainly uses

library(RSelenium)
remDrAll <- rsDriver(port = 4567L, browser = "chrome")
remDr <- remDrAll$client
remDr$close()
rm(remDrAll )
gc()

I see this is only a partial solution, though: I tried a few times and it only works some of the them. In the others I had to close and reopen R.

catatau
  • 28
  • 6