2

I am using Selenium 3.10.0 + ChromeDriver 2.37.543619 + Google Chrome 65.0.3325.162

I have a browser extension that I need when testing:

Browser extension

I am running this code:

  ChromeDriver webDriver = null;
  System.setProperty("webdriver.chrome.driver", new File("chromedriver").getAbsolutePath());
  System.setProperty("webdriver.chrome.logfile", "chromedriver.log");
  System.setProperty("webdriver.chrome.verboseLogging", "true");
  ChromeOptions chromeOptions = new ChromeOptions();
  chromeOptions.addArguments("--enable-logging", "--v=1", "--disable-sand-box");
  chromeOptions.setHeadless(true);
  chromeOptions.addExtensions(new File("/home/ndipiazza/Downloads/chrome-request-counter.crx"));
  webDriver = new ChromeDriver(chromeOptions);

I am getting the following error:

Starting ChromeDriver 2.37.543619 (a237acd3116cac3b3f0da42a000502ce3fafcb23) on port 6679
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to wait for extension background page to load: chrome-extension://nehbkkpdaccfofjkopcgnlhhgfoabbnc/_generated_background_page.html
from unknown error: page could not be found: chrome-extension://nehbkkpdaccfofjkopcgnlhhgfoabbnc/_generated_background_page.html
  (Driver info: chromedriver=2.37.543619 (a237acd3116cac3b3f0da42a000502ce3fafcb23),platform=Linux 4.13.0-37-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.27 seconds
Build info: version: '3.10.0', revision: '176b4a9', time: '2018-03-02T19:03:16.397Z'
System info: host: 'mate', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-37-generic', java.version: '1.8.0_141'

This works totally fine when using non-headless chrome.

Looks like a bug so I opened a bug here is the bug

Is there a workaround anyone knows of for this?

2

Oh blah!

https://stackoverflow.com/questions/45372066/is-it-possible-to-run-google-chrome-in-headless-mode-with-extensions/45372648#45372648

Firefox supports headless extensions but not google chrome. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.