0

I had a couple of cmd line options working with Selenium 3.3 as follows:

`DesiredCapabilities capabilities = new DesiredCapabilities();
 capabilities = DesiredCapabilities.Chrome();
 options.AddArguments("--lang=en-GB");
 options.AddArguments("--high-dpi-support=1");
 options.AddArguments("--force-device-scale-factor=0.8");
 capabilities = options.ToCapabilities() as DesiredCapabilities;
 Driver = new RemoteWebDriver(new Uri("WIN10:5566/wd/hub"), capabilities, 
 TimeSpan.FromSeconds(180));`

However switching to Selenium 3.5.2, these options are no longer being applied even when using new ToCapabilities() as follows:

ChromeOptions options = new ChromeOptions();
options.AddArguments("--lang=en-GB");
options.AddArguments("--high-dpi-support=1");
options.AddArguments("--force-device-scale-factor=0.5");
Driver = new RemoteWebDriver(new Uri("http://WIN10:5566/wd/hub"), options.ToCapabilities(), TimeSpan.FromSeconds(180));

Is there something else I need?

alex
  • 135
  • 3
  • 17
  • The version of `chromedriver.exe` installed on your remote node makes a difference. The `chromedriver.exe` component provided by Google’s Chromium team recently began to use a new capability name for Chrome-specific options to bring it in line with the W3C WebDriver Specification. The .NET binding assume you’re using a version of the executable that understands this new capability name. – JimEvans Sep 26 '17 at 01:10

2 Answers2

0

Try replacing

capabilities = options.ToCapabilities() as DesiredCapabilities; 

with the following the following:

capability.setCapability(ChromeOptions.CAPABILITY, options);

Then you only need to specify "capability" in the RemoteWebDriver:

RemoteWebDriver(new URL("your url"), capability);
smit9234
  • 361
  • 1
  • 7
0

Thanks smit, that would have worked as well. The problem was the chrome driver needed updating (embarrassed emoji here!)

alex
  • 135
  • 3
  • 17