C
C
cloneforce2020-11-12 19:41:24
Python
cloneforce, 2020-11-12 19:41:24

Selenium - Chromedriver won't start without headless?

Chrome driver won't start without --headless on Ubuntu via ssh connection

Code:

from seleniumwire import webdriver

driver = webdriver.Chrome("/var/script/chromedriver")
drvier.get("https://xenforo.com")
driver.close()
driver.quit()


When I run this code, I get this error:
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Suspicions go to the server itself. There is no monitor.
I think this is why Selenium asks to add "--headless"
Can this be fixed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Summer Breeze, 2020-11-12
@qipzone

I wonder where the muzzle will be drawn if there is no monitor?
Here either headless or in selenoid docker use

S
sergey, 2020-11-13
kuzmin @sergueik

you can also install xvnc https://habr.com/ru/post/76343/
or xvfb https://habr.com/ru/sandbox/20989/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question