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
我已经尝试了所有的解决方案,但没有什么对我有用。请帮助我?
答案 0 :(得分:0)
使用 Selenium v3.x , GeckoDriver 和 Firefox 时,您需要传递密钥 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()