Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!