CoolGuyHasChillDay
CoolGuyHasChillDay

Reputation: 747

RSelenium - starting server in the background (without window popup)

I recently got a new MacBook which seems to have changed several RSelenium settings. I've gotten my scraping to work properly again, except when I start a server with rsDriver, an actual window pops up and I don't know how to stop it.

I do like having this feature because it makes it so much easier to debug, but I run several scripts in the background while working and whenever rsDriver gets used it becomes the desktop focus. This is very frustrating since it disrupts whatever I'm currently working on.

To start a driver, I run:

remDrall <- rsDriver(port = 4446L, browser = "chrome", chromever = "84.0.4147.30", verbose = F)

When it's completed, a chrome window pops up with the url = "data:,". I feel like it should be an easy fix (like a silent = TRUE param), but I've looked through the documentation and can't find anything.

Running Catalina v 10.15.4

RSelenium package is v 1.7.1

Side note, but I'm not really sure how my rsDriver statement is working, since the port isn't the same as my docker image. I open up my docker with $ docker run -d -p 4567:4444 selenium/standalone-chrome, but if I try to use rsDriver(port = 4567L) then it doesn't work because it says the port is already in use. So I don't even have a docker image with port 4446, but my rsDriver statement still works...

Upvotes: 0

Views: 778

Answers (1)

rntq472
rntq472

Reputation: 21

Try adding:

extraCapabilities = list("chromeOptions" = list(args = list('--headless')))  

as an extra argument to rsDriver.

Upvotes: 2

Related Questions