Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility Issue with Selenium V4.1.1 C# #93

Open
rightmax1234 opened this issue May 27, 2022 · 5 comments
Open

Compatibility Issue with Selenium V4.1.1 C# #93

rightmax1234 opened this issue May 27, 2022 · 5 comments

Comments

@rightmax1234
Copy link

We're getting issues when upgrading selenium from V3.141.0 to V4.1.1
After updating, our environment variables are no longer getting read and it is failing on attempting to connect to browserstack. If I downgrade to 3.141.0 or lower it works but any version after this I get this authorization error. Have you any ideas?

Environment:
Windows: 10
Specflow: 3.9.74
Specflow-Actions-Browserstack: 0.1.322
Specflow.NUnit: 3.9.74

logs:
 FooterLinks("'Cookie Policy'","'Cookie Policy'","URL",null)
 Source: Footer.feature line 6
 Duration: 1.4 sec

Message: 
OpenQA.Selenium.WebDriverException : The new session command returned a value ('Authorization required') that is not a valid JSON object.
TearDown : OpenQA.Selenium.WebDriverException : The new session command returned a value ('Authorization required') that is not a valid JSON object.

Stack Trace: 
WebDriver.StartSession(ICapabilities desiredCapabilities)
WebDriver.ctor(ICommandExecutor executor, ICapabilities capabilities)
RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
RemoteWebDriver.ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout)
RemoteWebDriver.ctor(Uri remoteAddress, ICapabilities desiredCapabilities)
RemoteWebDriver.ctor(Uri remoteAddress, DriverOptions options)
BrowserstackDriverInitialiser.GetWebDriver(DriverOptions options)
BrowserstackChromeDriverInitialiser.CreateWebDriver(ChromeOptions options)
DriverInitialiser1.Initialise() BrowserDriver.CreateWebDriver() Lazy1.ViaFactory(LazyThreadSafetyMode mode)
Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) Lazy1.CreateValue()
Lazy1.get_Value() BrowserDriver.get_Current() BrowserInteractions.GoToUrl(String url) HookInitialize.BeforeScenario() line 66 TestExecutionEngine.FireEvents(HookType hookType) TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) TestExecutionEngine.OnScenarioStart() TestExecutionEngine.OnAfterLastStep() TestRunner.CollectScenarioErrors() FooterFeature_windows11_chrome.ScenarioCleanup() FooterFeature_windows11_chrome.FooterLinks(String link, String linkText, String url, String[] exampleTags) line 10 --TearDown WebDriver.StartSession(ICapabilities desiredCapabilities) WebDriver.ctor(ICommandExecutor executor, ICapabilities capabilities) RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) RemoteWebDriver.ctor(Uri remoteAddress, ICapabilities desiredCapabilities, TimeSpan commandTimeout) RemoteWebDriver.ctor(Uri remoteAddress, ICapabilities desiredCapabilities) RemoteWebDriver.ctor(Uri remoteAddress, DriverOptions options) BrowserstackDriverInitialiser.GetWebDriver(DriverOptions options) BrowserstackChromeDriverInitialiser.CreateWebDriver(ChromeOptions options) DriverInitialiser1.Initialise()
BrowserDriver.CreateWebDriver()
Lazy1.ViaFactory(LazyThreadSafetyMode mode) --- End of stack trace from previous location where exception was thrown --- Lazy1.CreateValue()
Lazy`1.get_Value()
BrowserDriver.get_Current()
BrowserstackRuntimePlugin.RuntimePluginTestExecutionLifecycleEventEmitter_AfterScenario(Object sender, RuntimePluginAfterScenarioEventArgs e)
RuntimePluginTestExecutionLifecycleEvents.RaiseAfterScenario(IObjectContainer objectContainer)
RuntimePluginTestExecutionLifecycleEventEmitter.RaiseExecutionLifecycleEvent(HookType hookType, IObjectContainer container)
TestExecutionEngine.FireEvents(HookType hookType)
TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
TestExecutionEngine.OnScenarioEnd()
TestRunner.OnScenarioEnd()
FooterFeature_windows11_chrome.TestTearDown()

Standard Output: 
Given a user begins a quote journey
-> skipped because of previous errors
And wants to view the 'Cookie Policy'
-> skipped because of previous errors
When the user clicks 'Cookie Policy'
-> skipped because of previous errors
Then user will be navigated to URL'
-> skipped because of previous errors

@mrampass
Copy link

Selenium 4 uses Webdriver protocol as opposed json wire protocol in selenium 3.
The way browserstack works with selenium has changed from selenium 3 to selenium 4 https://www.browserstack.com/automate/selenium-4#selenium4-update.
Specflow.Actions.Browserstack doesn't support Selenium 4 with its current implementation as Specflow.actions.browserstack code connects to Browserstack and passes capabilities compatible with selenium 3 so upgrading to selenium 4 will result in The new session command returned a value ('Authorization required') that is not a valid JSON object. error.

@jasonright
Copy link

Are you open to PR's so we can update to selenium 4?

@SabotageAndi
Copy link
Contributor

Yes, the SpecFlow.Action.Browserstack is working at the moment with the Selenium 3 Json Wire protocol capabilities.
So that Selenium 4 can be used, there is a little bit more work than updating the NuGet package.

I am happy to review any Pull Requests and help if there are questions about how to implement it. But we don't have any time to look at this in the moment and near future.

@jasonright
Copy link

Yes it is working but we're seeing our tests slowed down by up to 3-10x times which is basically nullifying any reason to even automate some of these tests. How come it's not looking likely to be updated by you guys as I would assume that's a pretty big reason to upgrade it? I can try and do a PR, just not too sure how long it'd take me to get me head around and then do it, as well do my normal work. If I am to try and update it, would the Specflow.Actions.Selenium package also need updating?

@SabotageAndi
Copy link
Contributor

@jasonright We are a small team with limited capacity and can't simply do everything. Also don't forget that you don't pay anything to use SpecFlow.
SpecFlow.Actions was always something that we are developing together with the community.

And yes, first the SpecFlow.Actions.Selenium package has to be upgraded to Selenium 4. As there are also other actions depending on that, this will be probably the most work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants