FuckTheWorld / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Can't instantiate Chrome webdriver while Ubuntu 14.04 screen is locked #834

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
Can't instantiate a Chrome webdriver while screen is locked using Ubuntu 14.04. 
I run automated tests via a cron job overnight and my desktop screen is always 
locked at that time. This worked fine before I upgraded to Ubuntu 14.04. I'm 
not absolutely sure but I have a feeling that the problem doesn't occur until 
the desktop display is turned off, not just at the lock screen. 

Steps to reproduce:
Using the ipython interpreter I ran the following:

In [1]: import time

In [2]: import selenium.webdriver as webdriver

In [3]: x = 0

In [4]: while True :
   ...:     driver = webdriver.Chrome(service_args=["--verbose", "--log-path=/home/jasonm/chrdrv.log"])
   ...:     x += 1
   ...:     print x
   ...:     time.sleep(5)
   ...:     driver.close()
   ...:     time.sleep(5)
   ...: 

I let this run for a while and I could see the webdriver appear and disappear 
before manually locking the screen (by pressing Ctrl+Alt+l). 

The python output is as follows (note the four successful runs before the 
exception is raised):
1
2
3
4
---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-5-8824aba1c560> in <module>()
      1 while True :
----> 2     driver = webdriver.Chrome(service_args=["--verbose", 
"--log-path=/home/jasonm/chrdrv.log"])
      3     x += 1
      4     print x
      5     time.sleep(5)

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.pyc 
in __init__(self, executable_path, port, chrome_options, service_args, 
desired_capabilities, service_log_path)
     63                 command_executor=self.service.service_url,
     64                 desired_capabilities=desired_capabilities,
---> 65                 keep_alive=True)
     66         except:
     67             self.quit()

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in __init__(self, command_executor, desired_capabilities, browser_profile, 
proxy, keep_alive)
     69         self.error_handler = ErrorHandler()
     70         self.start_client()
---> 71         self.start_session(desired_capabilities, browser_profile)
     72 
     73     @property

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in start_session(self, desired_capabilities, browser_profile)
    111             desired_capabilities['firefox_profile'] = browser_profile.encoded
    112         response = self.execute(Command.NEW_SESSION, {
--> 113             'desiredCapabilities': desired_capabilities,
    114         })
    115         self.session_id = response['sessionId']

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in execute(self, driver_command, params)
    162         response = self.command_executor.execute(driver_command, params)
    163         if response:
--> 164             self.error_handler.check_response(response)
    165             response['value'] = self._unwrap_value(
    166                 response.get('value', None))

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py
c in check_response(self, response)
    162         if exception_class == ErrorInResponseException:
    163             raise exception_class(response, message)
--> 164         raise exception_class(message, screen, stacktrace)
    165 
    166     def _value_or_default(self, obj, key, default):

WebDriverException: Message: u'unknown error: unable to discover open pages\n  
(Driver info: chromedriver=2.10.267518,platform=Linux 3.13.0-29-generic 
x86_64)' 

The chromedriver log from this is attached (I believe it was being overwritten 
upon each run so it may only contain the information from the last unsuccessful 
run). 

Original issue reported on code.google.com by jpmi...@gmail.com on 24 Jun 2014 at 12:17

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago
Unable to reproduce the issue. 

Please try again and let us know if we differ from what you are doing

Original comment by ssudunag...@chromium.org on 5 Mar 2015 at 11:08

GoogleCodeExporter commented 9 years ago

Original comment by ssudunag...@chromium.org on 26 Mar 2015 at 6:25

GoogleCodeExporter commented 9 years ago
If it makes any difference I'm running dual monitors, I know there are some 
other issues related to that. I also just reran the same test on my current 
Ubuntu installation (I had a total hard disk failure a while back and have 
re-installed my complete OS and configuration). 

In ipython I'm currently getting:
In [1]: import selenium.webdriver as webdriver

In [2]: driver = webdriver.Chrome(service_args=["--verbose", 
"--log-path=/home/jasonm/chrdrv.log"])
---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-3-a856ef39feb5> in <module>()
----> 1 driver = webdriver.Chrome(service_args=["--verbose", 
"--log-path=/home/jasonm/chrdrv.log"])

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.pyc 
in __init__(self, executable_path, port, chrome_options, service_args, 
desired_capabilities, service_log_path)
     63                 command_executor=self.service.service_url,
     64                 desired_capabilities=desired_capabilities,
---> 65                 keep_alive=True)
     66         except:
     67             self.quit()

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in __init__(self, command_executor, desired_capabilities, browser_profile, 
proxy, keep_alive)
     71         self.error_handler = ErrorHandler()
     72         self.start_client()
---> 73         self.start_session(desired_capabilities, browser_profile)
     74         self._switch_to = SwitchTo(self)
     75         self._mobile = Mobile(self)

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in start_session(self, desired_capabilities, browser_profile)
    119             desired_capabilities['firefox_profile'] = browser_profile.encoded
    120         response = self.execute(Command.NEW_SESSION, {
--> 121             'desiredCapabilities': desired_capabilities,
    122         })
    123         self.session_id = response['sessionId']

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in execute(self, driver_command, params)
    171         response = self.command_executor.execute(driver_command, params)
    172         if response:
--> 173             self.error_handler.check_response(response)
    174             response['value'] = self._unwrap_value(
    175                 response.get('value', None))

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py
c in check_response(self, response)
    164         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    165             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 166         raise exception_class(message, screen, stacktrace)
    167 
    168     def _value_or_default(self, obj, key, default):

WebDriverException: Message: unknown error: Chrome failed to start: exited 
abnormally
  (Driver info: chromedriver=2.13.307649 (bf55b442bb6b5c923249dd7870d6a107678bfbb6),platform=Linux 3.13.0-46-generic x86_64)

My current version of Selenium is: 2.44.0
My current Chome version is: Google Chrome 41.0.2272.89

Original comment by jpmi...@gmail.com on 30 Mar 2015 at 5:01

GoogleCodeExporter commented 9 years ago
jpmilen @

please try again with latest version of chromedriver and chrome and let us know 
if you are still facing the issue

Original comment by ssudunag...@chromium.org on 15 May 2015 at 9:08

GoogleCodeExporter commented 9 years ago
jpmilen

Unable to reproduce issue with chromedriver:2.16. Please try with latest 
version of chromedriver and chrome and let us know if you still facing the 
issue.

Sample Code:
from selenium import webdriver

driver=webdriver.Chrome(executable_path='/path/to/chromedriver',service_args=["-
-verbose", "--log-path=/path/to/chromedriver.log"])
driver.implicitly_wait(60)
driver.get('http://www.google.com/')

Original comment by ssudunag...@chromium.org on 23 Jun 2015 at 10:02

GoogleCodeExporter commented 9 years ago
Problem is still happening. Again in ipython, with Selenium version 2.44.0, 
chromedriver v2.16 and Chrome Version 42.0.2311.135 (64-bit)

In [1]: from selenium import webdriver

In [2]: import time

In [3]: for i in range(50):
   ...:     driver=webdriver.Chrome(executable_path='/usr/bin/chromedriver', service_args=["--verbose", "--log-path=/home/jasonm/cd-test.log'])
   ...:     driver.implicitly_wait(60)
   ...:     driver.get('http://www.google.com')
   ...:     try:
   ...:         driver.quit()
   ...:     except:
   ...:         pass
   ...: 

I saw a few successful instantiations before I locked my dual screen desktop 
and waited for the displays to turn off. When I unlocked my desktop I found the 
following (also attached the chromedriver log - cd-test.log):

---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-7-fd2d738fef44> in <module>()
      1 for i in range(50):
----> 2     driver=webdriver.Chrome(executable_path='/usr/bin/chromedriver', 
service_args=["--verbose", "--log-path=/home/jasonm/cd-test.log"])
      3     driver.implicitly_wait(60)
      4     driver.get('http://www.google.com')
      5     try:

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.pyc 
in __init__(self, executable_path, port, chrome_options, service_args, 
desired_capabilities, service_log_path)
     63                 command_executor=self.service.service_url,
     64                 desired_capabilities=desired_capabilities,
---> 65                 keep_alive=True)
     66         except:
     67             self.quit()

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in __init__(self, command_executor, desired_capabilities, browser_profile, 
proxy, keep_alive)
     71         self.error_handler = ErrorHandler()
     72         self.start_client()
---> 73         self.start_session(desired_capabilities, browser_profile)
     74         self._switch_to = SwitchTo(self)
     75         self._mobile = Mobile(self)

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in start_session(self, desired_capabilities, browser_profile)
    119             desired_capabilities['firefox_profile'] = browser_profile.encoded
    120         response = self.execute(Command.NEW_SESSION, {
--> 121             'desiredCapabilities': desired_capabilities,
    122         })
    123         self.session_id = response['sessionId']

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.pyc 
in execute(self, driver_command, params)
    171         response = self.command_executor.execute(driver_command, params)
    172         if response:
--> 173             self.error_handler.check_response(response)
    174             response['value'] = self._unwrap_value(
    175                 response.get('value', None))

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py
c in check_response(self, response)
    164         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    165             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 166         raise exception_class(message, screen, stacktrace)
    167 
    168     def _value_or_default(self, obj, key, default):

WebDriverException: Message: unknown error: unable to discover open pages
  (Driver info: chromedriver=2.16.333243 (0bfa1d3575fc1044244f21ddb82bf870944ef961),platform=Linux 3.13.0-46-generic x86_64)

Original comment by jpmi...@gmail.com on 7 Jul 2015 at 3:32

Attachments: