How to launch Chrome remotely with arguments

19 Aug

I’m trying to modify one part of our selenium_iStock-585x318
framework that launches Chrome like this:

ChromeOptions options = new ChromeOptions();
ChromeDriver driver = new ChromeDriver(new ChromeDriverService.Builder().usingDriverExecutable(new
File(DRIVER_LOCATION)).usingAnyFreePort().build(), options);

Instead, I want to use an instance of the ChromeDriver service that is already running,
using a RemoteWebDriver.

I’m doing this:
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“chrome.switches”, Arrays.asList(“-incognito”, “–user-data-dir=”));
//caps.setCapability(“args”, Arrays.asList(“-incognito”, “–user-data-dir=”));
RemoteWebDriver driver = new RemoteWebDriver(new URL(DRIVER_ADDRESS), caps);

Chrome launches fine and seems to functional, but the arguments are not passed to
the command line. I can see this in the UI (incognito icon missing) and also
verified the command-line params using ProcessExplorer. I’m running on Win7,
if it matters.

Leave a comment

Posted by on 19/08/2016 in Java, Selenium


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: