2 weshty joy weshty_joy 于 2018.08.11 15:09 提问

linux 执行python 异常 WebDriverException 10C

python执行日志:
[root@localhost opt]# python ./tbacnt_check.py
Traceback (most recent call last):
File "./tbacnt_check.py", line 36, in
driver = webdriver.Firefox(profile)
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 167, in init
keep_alive=True)
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in init
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/site-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

下面是火狐 驱动日志
[root@localhost opt]# cat geckodriver.log
1533960909134 geckodriver INFO geckodriver 0.19.1
1533960909139 geckodriver INFO Listening on 127.0.0.1:58648
1533960910337 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-profile" "/tmp/rust_mozprofile.YfTd8Xc4aSZ4"
Error: no DISPLAY environment variable specified

2个回答

caozhy
caozhy   Ds   Rxr 2018.08.11 17:56

你的linux没有安装图形么?

看这里:https://blog.csdn.net/j790675692/article/details/52693761

qq_42339655
qq_42339655   2018.08.11 15:50

看这个报错好像是环境变量的问题,建议查看一下环境变量,不行的话重新配置一下环境变量,
终端输入:echo $PATH 可以查看环境变量

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
selenium报WebDriverException错误
众所周知,Python是爬虫的利器,最近在做一爬虫,爬取网易云音乐热门歌曲的热门评论,发现网站是js的,所以想用selenium模拟浏览器渲染js后再获取相应的内容from selenium import webdriverbrowser = webdriver.Chrome()实例化谷歌浏览器对象时报以下错误WebDriverException: Message: 'chromedriver' e
处理使用selenium模块时常见的WebdriverException
处理使用selenium模块时常见的WebdriverException
WebDriverException: Message: connection refused异常解决
版本信息: * Platform: Windows 7 64bit * Firefox: 57.0.4 * Selenium:  3.8.1 使用selenium的webdirver.Firefox()报错,报错信息如下: 查看geckodriver.log的日志信息如下: 解决方法: 查阅网上很多资料,因为之前一直用都没报错,如今报错,猜测可能是版本问题导致,因
python3.5+django1.10:selenium.common.exceptions.WebDriverException->moveto did not match a known com
在运行webdriver调用ActionChains(driver).click_and_hold(on_element=element).perform()时抛出selenium.common.exceptions.WebDriverException异常,firefox版本51.0.1,在stackoverflow上找到别人遇到的同样的问题点击打开链接,其中第一个回答如下: Sadly th
python运行时提示WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
selenium:ChromeDriver executable needs to be available in path 安装 详细描述:想用chrome浏览器来执行测试用例,按照官方文档http://code.google.com/p/selenium/wiki/ChromeDriver 的步骤操作后还是报WebDriverException: Message: 'Chr
WebDriver(Selenium2) 常见异常及处理方法
Exception NoSuchElementException  Solutions     1. Check the locator of your target element.  2. If the locator is current. Try to wait for page load before find element.  3. If already wait for l
S01E01续 Python自动化测试robotframework出现WebDriverException解决方案
昨天安装了Python即robotframework自动化测试环境,但是在最后的验证阶段出现了错误。 如图: 查看log.html文件; 发现有:WebDriverException:Message:'geckodriver'executable needs to be in Path 错误,导致不能找到并打开浏览器导致报错。 原因:在网上查看后发现确实是因
WebDriverException:Message:'geckodriver'executable needs to be in Path
1.查看C:\Python27\Lib\site-packages\selenium\webdriver\firefox中的webdriver.py,在def_init_函数中,executable_path="geckodriver",之前搭建的环境上是executable_path="wires"; 2.geckodriver是一原生态的第三方浏览器,对于selenium3.x版本都会使
【Selenium异常】WebDriverException
异常类 org.openqa.selenium.WebDriverException异常提示信息org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (255, 575) (Session info: chrome=60.0.3112.113) (Driver inf
Selenium Webdriver常见错误、异常解答
Q:启动IE浏览器时突然报下面错误,不能正常使用。    WebDriverException: Message: Unexpected error launching Internet Explorer. Browser zoom level was set to 94%. It should be set to 100%A:原因是IE页面的使用的的显示比例不是100%导致的,把页面显示调整成1...