selenium.common.exceptions.WebDriverException:消息:进程意外关闭,状态为1

selenium.common.exceptions.WebDriverException:消息:进程意外关闭,状态为1,selenium,firefox,webdriver,geckodriver,Selenium,Firefox,Webdriver,Geckodriver,版本: firefox:Mozilla firefox 61.0 壁虎河:壁虎河v0.20.1 我只尝试了以下代码: from selenium import webdriver browser = webdriver.Firefox() 但得到的错误如下所示: Traceback (most recent call last): File "my.py", line 3, in <module> browser = webdriver.Firef

版本: firefox:Mozilla firefox 61.0 壁虎河:壁虎河v0.20.1

我只尝试了以下代码:

from selenium import webdriver

browser = webdriver.Firefox()
但得到的错误如下所示:

Traceback (most recent call last):
  File "my.py", line 3, in <module>
    browser = webdriver.Firefox()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
keep_alive=True)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute
self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status: 1
回溯(最近一次呼叫最后一次):
文件“my.py”,第3行,在
browser=webdriver.Firefox()
文件“/usr/local/lib/python2.7/dist packages/selenium/webdriver/firefox/webdriver.py”,第170行,在__
使_保持活动状态=真)
文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”,第156行,在__
启动会话(功能、浏览器配置文件)
文件“/usr/local/lib/python2.7/dist packages/selenium/webdriver/remote/webdriver.py”,第245行,在启动会话中
响应=self.execute(Command.NEW_会话,参数)
文件“/usr/local/lib/python2.7/dist packages/selenium/webdriver/remote/webdriver.py”,执行中第314行
self.error\u handler.check\u响应(响应)
文件“/usr/local/lib/python2.7/dist packages/selenium/webdriver/remote/errorhandler.py”,第242行,在check_响应中
引发异常类(消息、屏幕、堆栈跟踪)
selenium.common.exceptions.WebDriverException:消息:进程意外关闭,状态为1
和geckodriver.log:

1528101123327壁虎河信息壁虎河0.20.1

1528101123336壁虎河信息监听127.0.0.1:43481

1528101124336 mozrunner::runner INFO运行命令:“/usr/bin/firefox”“-marionete”“-profile”“/tmp/rust_mozprofile.y93GPXwtXuKC”

不支持在普通用户会话中以root用户身份运行Firefox。($XAUTHORITY是/home/username/.XAUTHORITY,由username拥有。)

这只是在根帐户中出现问题,请帮助..

此错误消息

Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/keti/.Xauthority which is owned by keti.)
…表示您试图以root用户身份调用Firefox浏览器,或者在非root会话中以root用户身份运行Firefox浏览器

根据这两个案例,这两个案例都不受支持,应该相对难以实现。但从技术上讲,这仍然是可能的(因为--新实例和--没有远程标志可用于控制远程控制),但X11的许可安全模型意味着用户基本上应该像对待无密码sudo一样对待用户帐户

以下是几个相关问题:

  • 如果用户以root用户身份运行Firefox,但使用自己的主目录,那么对于该用户来说,很多事情都会中断,有时会永久中断
随着Firefox v60.0的GA(通用性)的推出,Mozilla团队决定:

  • 早期运行的sudo-firefox,以前似乎可以工作,但不受支持,现在将无法在大多数Linux发行版上加载内容(任何页面上的选项卡崩溃),并且无法启动并打印消息,如下所示:

    Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /home/username/.Xauthority which is owned by username.)
    

那么,如果我重新安装以前版本的Firefox,可以吗?我应该以root用户身份运行Firefox浏览器(启动root@username在终端中)可能的重复可能与
错误有关:未指定显示环境变量