weixin_50779007
蜡笔小新不秃头
采纳率100%
2020-12-25 10:14 阅读 51

想要用selenium模拟打开chorme结果报错?

 

from selenium import webdriver

driver = webdriver.Chrome('/usr/local/bin')

driver.get('https://www.baidu.com/')

以上是一段代码

 

以下是报错

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/youwenhao/pythonProject/666.py", line 4, in <module>
    driver = webdriver.Chrome('/usr/local/bin')
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 86, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'bin' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    viewgroup viewgroup 2020-12-25 10:40

    PermissionError: [Errno 13] Permission denied: '/usr/local/bin'

    已经给提示了呀。。你没有权限调用bin目录下的东西。。所以driver.chrome 就没有办法启动

    点赞 1 评论 复制链接分享
  • weixin_42678268 bj_0163_bj 2020-12-25 11:27

    webdriver.Chrome('/usr/local/bin') 这里放的是chromedrive.exe ,你放个目录?

    点赞 1 评论 复制链接分享

相关推荐