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

How to solve critical chromedriver 111 issue? #3083

Closed
aybartsch opened this issue Mar 10, 2023 · 11 comments
Closed

How to solve critical chromedriver 111 issue? #3083

aybartsch opened this issue Mar 10, 2023 · 11 comments

Comments

@aybartsch
Copy link

Dear Serenity Devs.

With the update of chrome browser and chrome driver to version 111 a critical communication issue has been started:

Starting ChromeDriver 111.0.5563.64 (c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}) on port 5117
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Mar 10, 2023 10:16:20 AM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Invalid Status code=403 text=Forbidden
java.io.IOException: Invalid Status code=403 text=Forbidden

According to the thread on groups.google this issue seems to be caused by selenium itself. The workaround mentioned is to apply the chrome option "--remote-allow-origins=*".

Unfortunately, I cannot apply this switch in "serenity.conf" correctly i.e. the error is still shown. The below was not working:

chrome.switches = "--remote-allow-origins=*"

Why is the above switch not working as expected? Please, help to solve this critical issue.

Thanks and best regards, André

@abergmeister
Copy link

abergmeister commented Mar 10, 2023

I got it working by adding it to serenity.conf like this:

"goog:chromeOptions" { args = ["remote-allow-origins=*", ...] }

@wakaleo
Copy link
Member

wakaleo commented Mar 10, 2023

Thanks @abergmeister. The chrome.switches option is deprecated since Serenity 3.3.0 as using the w3c options is the preferred approach.

@aybartsch
Copy link
Author

Problem solved! Thanks to both of you.

@aybartsch
Copy link
Author

aybartsch commented Mar 10, 2023

Unfortunately, I cannot use firefox driver "-Dwebdriver.driver=firefox" when defining chrome options the above way.

Caused by: net.thucydides.core.webdriver.DriverConfigurationError: WebDriver was unable to create a new instance of type class org.openqa.selenium.firefox.FirefoxDriver
WebDriver reported the following message: Could not start a new session. Response code 500. Message: Unable to find a matching set of capabilities 
...
Build info: version: '4.8.0', revision: '267030adea'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.6.3', java.version: '11.0.15'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*]}, moz:debuggerAddress: true, moz:firefoxOptions: {args: [-headless, -headless], log: {level: error}}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*]}, moz:debuggerAddress: true, moz:firefoxOptions: {args: [-headless, -headless], log: {level: error}}}}]
See below for more details.

How can I define the capabilities for chrome driver only?

@aybartsch aybartsch reopened this Mar 10, 2023
@aybartsch
Copy link
Author

Solved by myself when removing the capability "browserName=chrome".

@jerrin89
Copy link

I got it working by adding it to serenity.conf like this:

"goog:chromeOptions" { args = ["remote-allow-origins=*", ...] }

@abergmeister could you please tell me where i need to put the above??

local {
rest.logging = true
headless.mode = false
mssql.db.username = "ucase_AutoTest"
mssql.db.password = "AutoTest1"
webdriver.base.url = "http://localhost"
mssql.db.connection = "jdbc:sqlserver://localhost:1433;databaseName=ucase;"
webdriver {
driver = chrome
}
}

@globalworming
Copy link
Collaborator

globalworming commented Mar 13, 2023

see https://serenity-bdd.github.io/docs/guide/driver_config#configuring-chromedriver-arguments

webdriver {
  capabilities {
    ...
    "goog:chromeOptions" {
      args = [ "start-maximized", "headless"]
    }
  }
}

@jerrin89
Copy link

@globalworming I have added that but not working for me
local {
rest.logging = true
headless.mode = false
mssql.db.username = "ucase_AutoTest"
mssql.db.password = "AutoTest1"
webdriver.base.url = "http://localhost"
mssql.db.connection = "jdbc:sqlserver://localhost:1433;databaseName=ucase;"
webdriver {
capabilities {
...
"goog:chromeOptions" {
args = [ "start-maximized", "headless"]
}
}
}
}

@globalworming
Copy link
Collaborator

remove the ...

@jerrin89
Copy link

jerrin89 commented Mar 13, 2023

@globalworming removed the dots but still the same

Exception in thread "main" com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) [Guice/ErrorInCustomProvider]: ConfigException$Parse: C:\Repos\BDD New\ucase-bdd\src\test\resources\serenity.conf: 125: unbalanced close brace '}' with no open brace (if you intended '}' to be part of a key or string value, try enclosing the key or value in double quotes)
  at ThucydidesModule.provideEnvironmentVariables(ThucydidesModule.java:71)
  at SystemPropertiesConfiguration.<init>(SystemPropertiesConfiguration.java:67)
      \_ for 1st parameter
  while locating SystemPropertiesConfiguration
  at ThucydidesModule.configure(ThucydidesModule.java:47)
  while locating Configuration

Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER

1 error

======================
Full classname legend:
======================
ConfigException$Parse:         "com.typesafe.config.ConfigException$Parse"
Configuration:                 "net.thucydides.core.webdriver.Configuration"
SystemPropertiesConfiguration: "net.thucydides.core.configuration.SystemPropertiesConfiguration"
ThucydidesModule:              "net.thucydides.core.guice.ThucydidesModule"
========================
End of classname legend:
========================

@globalworming
Copy link
Collaborator

serenity.conf: 125: unbalanced close brace '}' with no open brace

you messed up the format somewhere

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

5 participants