我尝试执行这个代码:
from selenium import webdriver
import time
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import schedule
from datetime import datetime
driver = webdriver.Chrome('/home/pi/Documents/chromedriver')
driver.get('http://google.com')
time.sleep(5)
以下是我收到的错误信息:
Traceback (most recent call last):
File "test2.py", line 12, in <module>
driver = webdriver.Chrome('/home/pi/Documents/chromedriver') # Optional arg$
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, 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 1335, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
有没有人知道如何解决这个问题?我已经尝试使用Firefox和xvfb,但目前还没有成功。
这里是在“.bashrc”中定义的路径:
export $PATH=$PATH:/home/pi/Documents/chromedriver