4

I am trying to do the same test but with selenide instead of selenium. The web site i am testing requires these 4 arguments otherwise won't work.

Is there a way to define browser args using Selenide?

    private val driver = ChromeDriver(ChromeOptions()
        .addArguments("--disable-blink-features")
        .addArguments("--disable-blink-features=AutomationControlled")
        .addArguments("--disable-dev-shm-usage")
        .addArguments("--no-sandbox")
    )

Tried both ways but it seems the args are ignored.

command line:

./gradlew test -Dchromeoptions.args=--diagnostics,--disable-blink-features,-disable-gpu,--start-maximized,--disable-blink-features=AutomationControlled,--disable-dev-shm-usage,--no-sandbox

kotlin. Tested inside a @BeforeAll - JUnit5

val desiredCapabilities = DesiredCapabilities()
desiredCapabilities.setCapability(
   ChromeOptions.CAPABILITY,
   ChromeOptions()
      .addArguments("--disable-gpu")
      .addArguments("--start-maximized")
      .addArguments("--disable-blink-features")
      .addArguments("--disable-blink-features=AutomationControlled")
      .addArguments("--disable-dev-shm-usage")
      .addArguments("--no-sandbox")
)
desiredCapabilities.setAcceptInsecureCerts(true)
Configuration.browserCapabilities = desiredCapabilities

Thank you

1 Answers1

2

Either via command line:

-Dchromeoptions.args=--diagnostics,--disable-blink-features 

or in java code:

ChromeOptions options = new ChromeOptions();
options.addArguments("--start-fullscreen", "--start-incognito");
options.setExperimentalOption("prefs", ImmutableMap.of("intl.accept_languages", "de_DE"));
Configuration.browserCapabilities = options;
open("https://codeborne.com";)

See https://selenide.org/2017/01/26/selenide-4.2.1/

Denis Abakumov
  • 355
  • 3
  • 11
Andrei Solntsev
  • 480
  • 2
  • 8