Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda