Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Driver Error using Selenium: Unable to Discover Open Pages

I'm getting a Chrome Driver related error when running my Selenium tests. The error message is "Unable to Discover Open Pages." The Selenium tests were all running fine until last evening. The problem seemed to begin after a reboot of the server the day before. I cannot reproduce this error on my local box. Running the Selenium tests from the command line on the server does open the Chrome Browser but results in the same error. Any ideas?

Line that is failing:

chromeDriver = new OpenQA.Selenium.Chrome.ChromeDriver(externalDriverPath);

Error message and stacktrace:

unable to discover open pages (Driver info: chromedriver=2.1,platform=Windows NT 6.1 SP1 x86_64) at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options) at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory) at SeleniumTests.BaseTest.SetupBrowsers()

When creating an instance of the ChromeDriver, a console window appears. The server with the error seems to refer to things NOT IMPLEMENTED.

ChomeDriver Output From the Server with the Error:

Started ChromeDriver (v2.1) on port 2984 [4700:4292:0108/111503:ERROR:gpu_info_collector_win.cc(102)] Can't retrieve a va lid WinSAT assessment. [4700:4292:0108/111503:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED [4700:4292:0108/111503:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENT ED [0108/111504:ERROR:gl_surface_egl.cc(132)] eglInitialize failed with error UNKNO WN [0108/111504:ERROR:gl_surface_win.cc(97)] GLSurfaceEGL::InitializeOneOff failed.

ChomeDriver Output From My PC which works fine:

Started ChromeDriver (v2.1) on port 18786 [884540:883760:0108/114010:ERROR:gpu_info_collector_win.cc(102)] Can't retrieve a valid WinSAT assessment. [884992:884996:0108/114010:ERROR:base_feature_provider.cc(122)] manifestTypes: A llowing web_page contexts requires supplying a value for matches. [885232:885236:0108/114011:ERROR:base_feature_provider.cc(122)] manifestTypes: A llowing web_page contexts requires supplying a value for matches. [884540:883760:0108/114011:ERROR:base_feature_provider.cc(122)] manifestTypes: A llowing web_page contexts requires supplying a value for matches. [0108/114011:ERROR:gl_surface_egl.cc(131)] eglInitialize failed with error UNKNO WN [0108/114011:ERROR:gl_surface_win.cc(54)] GLSurfaceEGL::InitializeOneOff failed.

like image 986
James Lawruk Avatar asked Jan 08 '14 16:01

James Lawruk


People also ask

What is a Chrome driver in Selenium?

ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors.

How do I set a Chrome driver path?

Go to the terminal and type the command: sudo nano /etc/paths. Enter the password. At the bottom of the file, add the path of your ChromeDriver. Type Y to save.

How do I enable drivers in Chrome?

Below are the steps to follow while configuring the chrome setup for Selenium. #1) Check the version of the chrome. #3) Download the chromedriver.exe file for the respective OS and copy that .exe file into your local. #4) The path of the chromedriver (C:\webdriver\chromedriver.exe) will be used in our program.


5 Answers

You are using a highly outdated version of the ChromeDriver. Your first port of call should be to update it here.

I would highly suspect the problem is your Chrome on your server has updated, and ChromeDriver v2.1 doesn't support any recent versions of Chrome.

like image 87
Arran Avatar answered Oct 17 '22 23:10

Arran


Look here for other possible solutions: https://groups.google.com/forum/?hl=en#!topic/selenium-users/gfvfH-YEC48

In my case, adding the --no-sandbox argument to ChromeOptions solved the problem.

like image 34
patty Avatar answered Oct 17 '22 21:10

patty


Here's a quick workaround I found while digging around to get rid of that error: unknown error: unable to discover open pages

In your protractor config file, add the following:

 capabilities: {
    browserName: 'chrome',
    chromeOptions: {
      args: ['--no-sandbox']
    }   
},

The most important line there is the --no-sandbox; adding that line somehow gets rid of that error.

I am not exactly sure why it works but it's a workaround I found while digging around online.

***********************************UPDATES as of 10/04/2016***********************************

Please ignore this part right above as that workaround is NOT a proper fix; below I show you the actual fix to your problem; you just have an outdated chrome driver and running "webdriver-manager update" will only update up to v2.22 so I'll show you how to grab v2.24 right below.


Read on if your webdriver-manager update doesn't update chromedriver to the latest i.e past v2.22 OR to v2.24 as of 10/04/2016.

I lost a few weeks pulling my hair around an issue I had with "Unable to discover open pages" and every time I would update the chromedriver, it would update to version 2.22 for chromedriver and I believe the selenium server to v2.53. My problem wasn't really with the selenium server so v2.53 was fine.

Issue was with chromedriver v2.22. 

Eventhough this chromdriver link showed that there was a latest version of 2.24, 'webdriver-manager update' would NOT pick up that latest version, it would only grab version 2.22 of the chrome driver.

How did I go around this?

Simply run the command below after you check this link for which version of chromedriver you want to update to; for instance, I wanted v2.24 so I ran the command below:

webdriver-manager update --versions.chrome 2.24

If you check your location: C:\Users\<USER>\AppData\Roaming\npm\node_modules\webdriver-manager\selenium\

You should see that the desired chromedriver was downloaded there; if it's not there, read the command prompt logs and it'll tell you where it downloaded your chromdriver files.

Hope that helps someone!

like image 30
pelican Avatar answered Oct 17 '22 23:10

pelican


I had the same problem, but updating to the latest ChromeDriver (v2.8) did not solve it for me. I was running Selenium on a CI server (A Dell machine running 64 bit Win 7). I got the exception every time when the server had been 'idle' for a while.

What fixed the problem for me was to set 'Turn off display after' in Windows' Power Options to 'Never'.

like image 34
Michael Herrmann Avatar answered Oct 17 '22 21:10

Michael Herrmann


I am running selenium with python in Docker on a Google compute instance. For me, the issue was that my instance didn't have enough memory, and my scrape job would fail with this error. Upgrading it to g1-small resolved the issue for me.

like image 35
nakamin Avatar answered Oct 17 '22 23:10

nakamin