I'm trying to modify one part of our framework that launches Chrome like this:
ChromeOptions options = new ChromeOptions();
options.addArguments("-incognito");
options.addArguments("--user-data-dir=");
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.
Is there some other way I should be going about this?
For purposes of this discussion, please ignore the specific arguments in this
example - I'm trying to determine how to do this for any set of Chrome arguments.
Chris
--
------------------------------------------------------------------------ -
Chris Merrill | Web Performance, Inc.
ch...@webperformance.com |
http://webperformance.com
919-433-1762 |
919-845-7601
Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -