【问题标题】:Not able to use geckodriver on linux mint 18无法在 linux mint 18 上使用 geckodriver
【发布时间】:2018-10-12 14:32:03
【问题描述】:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import urllib
import requests
import time

email = ""
password = ""

driver = webdriver.Firefox()

我使用的是 linux mint 18,在运行上面的代码块后,我收到了这个错误消息

   Traceback (most recent call last):
  File "quora_twitter_linkurl.py", line 11, in <module>
    driver = webdriver.Firefox()
  File "/home/bk/anaconda2/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 152, in __init__
    self.service.start()
  File "/home/bk/anaconda2/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/home/bk/anaconda2/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/home/bk/anaconda2/lib/python2.7/subprocess.py", line 1025, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error

我已经尝试了所有的解决方案,但没有一个对我有用。请帮助我?

【问题讨论】:

  • Selenium Client / WebDriver / WebClient 变体和版本。
  • 我正在使用 python 2.7 和 selenium 版本 3.11.0 和 geckodriver v0.20.1-arm7hf 和 firefox 版本 59.0.2

标签: python-2.7 selenium selenium-webdriver mozilla geckodriver


【解决方案1】:

在使用 Selenium v​​3.xGeckoDriverFirefox 时,您需要传递 Key executable_path 以及 Value 指示 GeckoDriver 二进制文件的绝对路径,如下所示:

from selenium import webdriver

driver = webdriver.Firefox(executable_path=r'C:\path\to\geckodriver.exe')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()

【讨论】:

  • 不工作,我正在使用 linux mint 18 并且已经尝试过了。
  • @BhupeshKurdia Not working 没有说明发生了什么错误。使用您当前的代码和错误堆栈跟踪更新问题。
猜你喜欢
  • 2016-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多