当前位置:   article > 正文

python无法打开 firefox浏览器_无法使用Selenium打开Firefox浏览器

pyth调用火狐浏览器失败无报错

我在Ubuntu Linux 14.04上尝试使用python脚本打开firefox浏览器时收到以下错误消息:File "seleniumtest.py", line 3, in

browser = webdriver.Firefox()

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 145, in __init__

self.service.start()

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 74, in start

stdout=self.log_file, stderr=self.log_file)

File "/usr/lib/python2.7/subprocess.py", line 710, in __init__

errread, errwrite)

File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child

raise child_exception

OSError: [Errno 8] Exec format error

示例代码为:

^{pr2}$

像geckodriver这样的依赖项已经安装。在wget https://github.com/mozilla/geckodriver/releases/download/v0.13.0/geckodriver-v0.13.0-linux64.tar.gz

tar -xvzf geckodriver-v0.13.0-linux64.tar.gz

rm geckodriver-v0.13.0-linux64.tar.gz

chmod +x geckodriver

cp geckodriver /usr/local/bin/

添加“executable_path=”/usr/local/bin/geckodriver”,输出如下:File "seleniumtest.py", line 3, in

browser = webdriver.Firefox(executable_path="/usr/local/bin/geckodriver")

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 145, in __init__

self.service.start()

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 74, in start

stdout=self.log_file, stderr=self.log_file)

File "/usr/lib/python2.7/subprocess.py", line 710, in __init__

errread, errwrite)

File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child

raise child_exception

OSError: [Errno 8] Exec format error

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/919605
推荐阅读
相关标签
  

闽ICP备14008679号