2

This is identical scenario to Cannot call non W3C standard command while in W3C mode (Selenium::WebDriver::Error::UnknownCommandError) with Selenium ChromeDriver in Cucumber Ruby but the solutions don't seem to apply directly to C# so rather than ask in the comments I thought it more appropriate to start a separate thread.

After Chrome upgraded to v.76 I had to update Chromedriver.exe to v.76. I immediately started getting the error in the title. Searching for the issue you find that starting with v75 "ChromeDriver now runs in W3C standard compliant mode by default." The suggested workaround is to "specifying w3c:false in ChromeOptions".

I'm asking for help on how to specify this in .net Webdriver

I use ChromeOptions options = new ChromeOptions(); and then I update options as needed before doing driver = new ChromeDriver(@"c:\WebDriver", options); I haven't been able to figure out how to add the 'w3c',false as, for instance, add_experimental_option doesn't exist in C# Webdriver.

Joel
  • 647
  • 2
  • 11
  • 22

1 Answers1

3

You can try setting the UseSpecCompliantProtocol to false . Its true by default .ChromiumOptions.cs

Refer commit for this option Available in 3.141

    private const string UseSpecCompliantProtocolOption = "w3c";
    private bool useSpecCompliantProtocol = true;

        /// <summary>
        /// Gets or sets a value indicating whether the <see cref="ChromiumDriver"/> instance
        /// should use the legacy OSS protocol dialect or a dialect compliant with the W3C
        /// WebDriver Specification.
        /// </summary>
        public bool UseSpecCompliantProtocol
        {
            get { return this.useSpecCompliantProtocol; }
            set { this.useSpecCompliantProtocol = value; }
        }

To set w3c = false.

options.UseSpecCompliantProtocol = false;
Rahul L
  • 4,249
  • 15
  • 18
  • Thanks for the reply. That seems logical but it doesn't make the error go away. – Joel Aug 01 '19 at 16:26
  • Which version of selenium are you using ? – Rahul L Aug 01 '19 at 16:51
  • ...and now it seems fixed. Can I assume 3.141 was a required part of the solution? – Joel Aug 01 '19 at 17:42
  • Yes it seems at least for c# binding https://github.com/SeleniumHQ/selenium/commit/005a942a5ce0a63a5917c3eb7386c02a2de8700b refer this commit . Added it in answer. – Rahul L Aug 01 '19 at 17:48
  • Thank you Rahul! for some reason when I looked for an update yesterday I didn't find it. – Joel Aug 01 '19 at 17:54
  • https://raw.githubusercontent.com/SeleniumHQ/selenium/master/dotnet/CHANGELOG change log says this option is added in 3.141 – Rahul L Aug 01 '19 at 17:55
  • 1
    Thanks for adding that, I was just coming back to say that the commit referenced selenium-4.0.0-alpha-2, but the changelog confirms that it's in 3.141. – Joel Aug 01 '19 at 17:58