So now that Chrome 59 has headless support and a proper driver for it (Chromedriver 2.30), I tried migrating my code to it.
--headless flag works by itself.
--proxy-server flag works by itself, however
combining the two hangs the browser.
Is there a workaround for it?
Env:
- Chrome 59
- Chromedriver 2.30
- selenium 2.46.0
Code:
from selenium import webdriver
chop = webdriver.ChromeOptions()
chop.add_argument("--headless")
chop.add_argument("--proxy-server=socks5://127.0.0.1:8080")
d = webdriver.Chrome(chrome_options=chop)
print("done")
d.get('http://ipinfo.io')
print(d.page_source)
Traceback:
Traceback (most recent call last):
File "t.py", line 5, in <module>
d = webdriver.Chrome(chrome_options=chop)
File "/home/t/env/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
keep_alive=True)
File "/home/t/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 89, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/t/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 138, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/t/env/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 195, in execute
self.error_handler.check_response(response)
File "/home/t/env/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 170, 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.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 4.4.0-21-generic x86_64)
This bug has been resolved.
I just tested it with the follow setup:
Ubuntu 16.04 64 bit
Google Chrome 61.0.3163.59 beta (official release still hangs atm;)
Selenium 3.5.0
ChromeDriver 2.31
No more xvfb required.
I am a happy man today.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With