'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

前端 未结 11 563
醉梦人生
醉梦人生 2020-11-22 16:23

I\'ve looked around checked both documentations and have found no answer.

I\'ve been trying to use InstaPy a instagram api for python. After failing with multiple er

相关标签:
11条回答
  • 2020-11-22 17:01

    had same issue in django.

    However when I ran the same code locally (not activating my django app) it was fine and didn't have to explicitly define the path to the chrome driver.

    Got around it by explicitly defining the path and the chromederiver.exe

    similar to the answer above. path = "C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe"

    in my case, since I want to eventually post my app I used dynamic paths

    ie.

    import os
    
    BASE_oaAPP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    BASE_oaAPP_Utilities_DIR  = os.path.join(BASE_oaAPP_DIR, 'mySubFolderInTheApp')
    
    def utilsPathFileName(fileName):
        return os.path.join(BASE_oaAPP_Utilities_DIR, fileName)
    
    chrome_path = utilsPathFileName('chromedriver.exe')
    driver = webdriver.Chrome(chrome_path)
    
    0 讨论(0)
  • 2020-11-22 17:04

    we can fix this issue for centos

    #Install package chromedriver. Install it using yum    
    yum install chromedriver
    
    #Import following package in python.
    from selenium import webdriver
    
    #Add following options before initializing the webdriver
    chromeOptions = webdriver.ChromeOptions()
    chromeOptions.add_argument("--headless")
    chromeOptions.add_argument("--remote-debugging-port=9222")
    chromeOptions.add_argument('--no-sandbox')
    driver = webdriver.Chrome('/usr/bin/chromedriver',chrome_options=chromeOptions)
    
    0 讨论(0)
  • 2020-11-22 17:07

    For me, none of the answers above worked. But moving the chromedriver.exe to a new path (desktop in my case) solved it.

    path = "C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe"
    
    0 讨论(0)
  • 2020-11-22 17:09

    locate your installed driver.exe, shift+right click, copy as path, paste it to your IDE

    0 讨论(0)
  • 2020-11-22 17:10

    You just have to add

    /chromedriver.exe

    at the end of the path like this:

    driver = webdriver.Chrome('C:/Users/User/Downloads/chromedriver_win32/chromedriver.exe')

    Note: If you copy the path from "File Explorer" you will get:

    C:\Users\User\Downloads\chromedriver_win32

    You will need to use double backslashes like this:

    C:\\Users\\User\\Downloads\\chromedriver_win32

    so you don't get a syntax error. Or you can just use forward slashes.

    0 讨论(0)
  • 2020-11-22 17:12

    If you are on a linux os, changing file permissions could possibly fix the problem. But beware of what you do with permissions:

    chmod 755 "/path to chromedriver file"
    

    I downloaded the file via python itself, which unfortunately disabled execution permission and this was the quick fix for it.

    0 讨论(0)
提交回复
热议问题