Theobalds 2017-08-13 10:17 采纳率: 33.3%
浏览 1166

怎麼樣在ubuntu安裝chrome driver

輸入代碼如下:
from selenium import webdriver
import time
brower = webdriver.Chrome()
brower.get('http://www.taobao.com/')
input = brower.find_element_by_id('q')
input.send_keys('iphone')
time.sleep(1)
input.clear()
input.send_keys('ipad')
button = brower.find_element_by_class_name('btn-search')
button.click()
運行結果:r/bin/python3.5 /home/eric/PycharmProjects/untitled12/stt.py
Traceback (most recent call last):
File "/home/eric/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "/usr/lib/python3.5/subprocess.py", line 947, in init
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/eric/PycharmProjects/untitled12/stt.py", line 3, in
brower = webdriver.Chrome()
File "/home/eric/.local/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in init
self.service.start()
File "/home/eric/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/h

  • 写回答

1条回答 默认 最新

  • devmiao 2017-08-14 15:55
    关注
    评论

报告相同问题?

悬赏问题

  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能