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

Getting SerenityManagedException for chrome driver "goog:chromeOptions" in serenity.properties file #2964

Closed
Ramesh1103 opened this issue Nov 7, 2022 · 6 comments
Labels

Comments

@Ramesh1103
Copy link

Ramesh1103 commented Nov 7, 2022

i am trying to upgrade serenity from 3.1 to 3.3.4 but facing issue with chrome options .
currently i am using serenity. Properties file like below

webdriver.driver = chrome
webdriver.autodownload = true
chrome.switches = --headless;--no-sandbox;--disable-dev-shm-usage;--window-size=1920,1080
but as per latest changes i am not able to set "goog:chromeOptions"
i tried below
webdriver.capabilities.chromeOptions = --headless;--no-sandbox;--disable-dev-shm-usage;--window-size=1920,1080
webdriver.capabilities = {goog:chromeOptions {args: ["no-sandbox","disable-dev-shm-usage","window-size=1920,1080"]}}

Getting below error

�[31mnet.serenitybdd.core.exceptions.SerenityManagedException: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap.of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'
at org.openqa.selenium.chrome.AddHasCasting.getAdditionalCommands(AddHasCasting.java:38)
at org.openqa.selenium.chrome.ChromeDriver$ChromeDriverCommandExecutor.getExtraCommands(ChromeDriver.java:98)
at org.openqa.selenium.chrome.ChromeDriver$ChromeDriverCommandExecutor.(ChromeDriver.java:93)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:81)
at net.serenitybdd.core.webdriver.driverproviders.ChromeDriverProvider.newInstance(ChromeDriverProvider.java:73)
at net.thucydides.core.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:161)
at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:140)
at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:165)
at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:156)
at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:126)
at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:196)
at net.serenitybdd.core.pages.PageObject.openPageAtUrl(PageObject.java:983)
at net.serenitybdd.core.pages.PageObject.openUrl(PageObject.java:929)
at com.cbre.webui.commons.WebActions.openApplication(WebActions.java:59)
at com.cbre.commons.WebBasePage$ByteBuddy$4VF3o5KA.openApplication$accessor$kXX2RUmA(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at net.thucydides.core.steps.BaseMethodRunner.invokeMethod(BaseMethodRunner.java:18)
at net.thucydides.core.steps.NormalMethodRunner.invokeMethodAndNotifyFailures(NormalMethodRunner.java:18)
at net.thucydides.core.steps.StepInterceptor.runNormalMethod(StepInterceptor.java:406)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:191)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:84)
at net.thucydides.core.steps.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:51)
at com.cbre.commons.WebBasePage$ByteBuddy$4VF3o5KA.openApplication(Unknown Source)
at com.cbre.steps.web.Hooks.beforeScenario(Hooks.java:27)

@sandeepraina-lenze
Copy link

sandeepraina-lenze commented Nov 8, 2022

Try the following

webdriver {
  driver = "chrome"
  autodownload = true

  timeouts {
    script = 30000
    pageLoad = 300000
    implicit = 15000
  }

  capabilities {
    browserName = "chrome"
    acceptInsecureCerts = true
    "goog:chromeOptions" {
      args = ["start-maximized", "test-type", "no-sandbox", "ignore-certificate-errors", "disable-popup-blocking", "disable-default-apps", "disable-extensions-file-access-check", "incognito", "disable-infobars", "disable-gpu", "user-agent=Apache", "disable-dev-shm-usage", "window-size=1920,1080", "enable-features=NetworkService"]
    }
  }
}

@oleksandr-kobzan-philips

Hello @sandeepraina-lenze,
Does 'disable-infobars' option work for you in Chrome?
because for me it doesn't, I still see 'Chrome is being controlled by automated software'

@Ramesh1103
Copy link
Author

Ramesh1103 commented Nov 8, 2022

@sandeepraina-lenze,
I would like to have equivalent serenity.properties instead of serenity.conf

@wakaleo
Copy link
Member

wakaleo commented Nov 8, 2022

@sandeepraina-lenze, I would like to have equivalent serenity.properties instead of serenity.conf

The serenity.properties file only works for non-structured properties, so we recommend moving to using the serenity.conf format. WebDriver capabilities are only fully supported in the serenity.conf file.

@sandeepraina-lenze
Copy link

sandeepraina-lenze commented Nov 8, 2022

Hello @sandeepraina-lenze, Does 'disable-infobars' option work for you in Chrome? because for me it doesn't, I still see 'Chrome is being controlled by automated software'

Try --enable-automation this may help you to probably hide the 'Chrome is being controlled by automated software' infobar

You can send the excludeswitch - enable-automation to hide the message. and to disable pop up 'Disable developer mode extensions' set useAutomationExtension=false

 "goog:chromeOptions": {

        "excludeSwitches": [ "enable-automation" ],
        "useAutomationExtension": false
     }

@Ramesh1103
Copy link
Author

Thanks @sandeepraina-lenze and @wakaleo

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

No branches or pull requests

4 participants