SpecFlowOSS / SpecFlow.Actions

BSD 3-Clause "New" or "Revised" License
57 stars 53 forks source link

Method AddAdditionalCapability not found. #109

Closed antoinerichez closed 2 years ago

antoinerichez commented 2 years ago

Package version: 0.1.332 Selenium version: 4.3.0

Hello, we are facing an issue when trying to add arguments to a browser.

This is the stack trace we got:

System.MissingMethodException: Method not found: 'Void OpenQA.Selenium.DriverOptions.AddAdditionalCapability(System.String, System.Object)'.
   at SpecFlow.Actions.Selenium.DriverInitialisers.DriverOptionsHelper.TryToAddArguments[T](T options, String[] arguments)
   at SpecFlow.Actions.Selenium.DriverInitialisers.DriverInitialiser`1.AddArgumentsFromConfiguration(T options)
   at SpecFlow.Actions.Selenium.DriverInitialisers.DriverInitialiser`1.CreateOptions()
   at SpecFlow.Actions.Selenium.DriverInitialisers.DriverInitialiser`1.Initialise()
   at SpecFlow.Actions.Selenium.BrowserDriver.CreateWebDriver()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at SpecFlow.Actions.Selenium.BrowserDriver.get_Current()

Here is the content of the specflow.actions.json:

{
  "selenium": {
    "browser": "chrome",
    "arguments": [
      "--headless"
    ],
    "defaultTimeout": 10,
    "pollingInterval": 5
  }
}

Could you please help us in resolving this issue ?

I wish, to all of you, a nice day.

kapros commented 2 years ago

It's because Selenium is 4.x, whereas the current actions is still at 3.x, @SabotageAndi. Oddly enough, the debugger won't even let me get into DriverOptionsHelper.TryToAddArguments and throws immediately, and at the same time I can clearly see the AddAdditionalCapability is available for all browsers.

kapros commented 2 years ago

It's because Selenium is 4.x, whereas the current actions is still at 3.x, @SabotageAndi. Oddly enough, the debugger won't even let me get into DriverOptionsHelper.TryToAddArguments and throws immediately, and at the same time I can clearly see the AddAdditionalCapability is available for all browsers.

update on this - I updated both Selenium and Selenium.Support to 4.3 and only then did I get the error to reproduce compile-time. So looks like there are breaking changes between the updates from 3.x to 4.x which need to be sorted, it's not exactly quick fix.

SabotageAndi commented 2 years ago

Selenium 4 is not supported yet. See also https://github.com/SpecFlowOSS/SpecFlow.Actions/issues/93