37,741
社区成员
发帖
与我相关
我的任务
分享
[root@data-download bin]# geckodriver -h
geckodriver 0.26.0 (e9783a644016 2019-10-10 13:38 +0000)
WebDriver implementation for Firefox
[root@data-download lib64]# firefox -version
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support!
Mozilla Firefox 68.6.0esr
[root@data-download /]# python3
Python 3.7.7 (default, Apr 17 2020, 13:56:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> option = webdriver.FirefoxOptions()
>>> option.add_argument('headless')
>>> option.add_argument('no-sandbox')
>>> option.add_argument('disable-dev-shm-usage')
>>> driver = webdriver.Firefox(executable_path='/usr/local/bin/geckodriver', options=option)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python3/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/local/python3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/python3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/python3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/python3/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
>>> [root@data-download /]# cat geckodriver.log
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
1587215249839 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "headless" "no-sandbox" "disable-dev-shm-usage" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileiiBFaQ"
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support!
Error: no DISPLAY environment variable specified