Selenium Chrome Driver - Exception when trying headless option

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Selenium Chrome Driver - Exception when trying headless option

dushkin
I am trying to use chrome but I need it to be hidden from the user.
So I tried to use "headless" with ChromeOptions

ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("C://temp//1.14.12_0.crx"));
options.addArguments("disable-infobars");
options.addArguments("headless");



but then I crashed with the following exception:

    [1524948093.974][WARNING]: chrome quit unexpectedly, leaving behind temporary directories for debugging:
    [1524948093.974][SEVERE]: Port leaked: 12545
    Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: failed to wait for extension background page to load: chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/background.html
    from unknown error: page could not be found: chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/background.html
      (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Windows NT 10.0.16299 x86_6

I made some searching and found out that it might be related to the fact that I also load an ad blocker extension, so I temporarily commented the extension loading and the chrome was loaded HIDDEN.
But I still need this extension to work for me when chrome is hidden.

Is there any solution?

Chrome Version - 66
Chrome Driver version - 2.37
Thanks


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7d7b8894-a2be-4870-bbcc-328937f56d60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.