0

I'm trying to run chrome headless with selenium in Python. I tried xvfb-run -a python3 message.py And i get this error:

Traceback (most recent call last):
  File "message.py", line 388, in <module>
    initialize()
  File "message.py", line 54, in initialize
    driver = webdriver.Chrome(chrome_options = chrome_options)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.33.506178 (69ae10f91723897591ef1a3b465aa5d35011eb5e),platform=Linux 3.13.0-96-generic x86)

And initialize():

   chrome_options = webdriver.ChromeOptions()
   chrome_options.add_argument("--headless")
   chrome_options.add_argument("--no-sandbox")
   chrome_options.add_argument("--verbose")
   chrome_options.add_argument("--log-path=chrome.log")
   chrome_options.add_argument("window-size=1200x600")
   chrome_options.add_argument("user-data-dir=\\")
   driver = webdriver.Chrome(chrome_options = chrome_options)
   driver.get('http://google.com')

I'm using Python 3.5 and chromedriver 2.33.506178 for Linux32 (Ubuntu as Server without Desktop) I tested the same code on my other pc with linux mint, all works fine.

Hope you can help me :)

ascawath
  • 59
  • 8
  • Possible duplicate of [unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.9](https://stackoverflow.com/questions/22558077/unknown-error-chrome-failed-to-start-exited-abnormally-driver-info-chromedri) – demouser123 Jan 12 '18 at 19:28
  • I don't want to use Jenkins, whether this isn't necessary. So this post is not helpful, i think. – ascawath Jan 13 '18 at 00:20
  • It's not about jenkins. It's about using chrome in headless mode using xvfb. You need to set the display amount to either zero or something. Read through the post. – demouser123 Jan 13 '18 at 06:46
  • At least I already tried to set the display value 0:0 . But i still get this error. – ascawath Jan 13 '18 at 13:46

1 Answers1

0

After checking my actual rights of writing/reading/executing I found my mistake. chromedriver weren't able to load while trying to execute with root rights. After I changed chromedrivers permission all works fine now.

ascawath
  • 59
  • 8