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
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体