Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
executeScript method is working when using WebDriver but fail when using RemoteWebDriver

I am encountering a situation where when I try to execute executeScript for scrolling in the page, I am getting an error where the action fail and I am getting the following errors:

[ERROR]org.openqa.selenium.remote.RemoteWebDriver.isJavascriptEnabled
java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.Capabilities.is(String)" because "this.capabilities" is null

and this is how I initialized my remote webdriver:

private DriverFactory createChromeInst(File downloadsFolder) throws MalformedURLException {
        ChromeOptions options = new ChromeOptions();
        options.setHeadless(EnvConf.getAsBoolean("selenium.headless"));
        options.setAcceptInsecureCerts(true);
        options.addArguments("--lang=" + EnvConf.getProperty("selenium.locale"));
        options.addArguments("--disable-dev-shm-usage");
        LoggingPreferences logPrefs = new LoggingPreferences();
        logPrefs.enable(LogType.BROWSER, Level.SEVERE);

        options.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
        options.addArguments("--window-size=" + EnvConf.getProperty("selenium.window_size"));
        options.addArguments("webkit.webprefs.javascript_enabled");
        options.addArguments("allow-running-insecure-content");
        options.addArguments("browser.allow_javascript_apple_events");
        options.addArguments("--javascript=true");
        this.driver = new RemoteWebDriver(new URL(completeUrl), options);
        this.driver.setFileDetector(new LocalFileDetector());
        return new DriverFactory(driver);
}

Is there an equivalent for DesiredCapabilities method setJavascriptEnabled(true) when using ChromeOptions? I tried to look for it and did not find a solution for this problem.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda