试图为 Instagram 制作自动关注机器人

trying to make auto follow bot for Instagram

from selenium import webdriver

from time import sleep

driver = webdriver.Chrome(executable_path=r'C:\Users\VANIKO\Desktop\chromedriver.exe')

driver.get("https://www.instagram.com/")
sleep(5)

但我收到以下错误消息:

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary. 

我认为你应该定义 Chrome 浏览器可执行文件的位置 chrome.exe
试试这个:

options = webdriver.ChromeOptions()
options.binary_location = "C:\Program Files\Google\Chrome\Application\chrome.exe"
driver = webdriver.Chrome(chrome_options = options, executable_path=r'C:\Users\VANIKO\Desktop\chromedriver.exe')

只需验证您的 chrome.exe 已安装到我提到的默认位置。否则将其更改为 chrome.exe 在您计算机上的实际路径。

看起来 ChromeDriver 无法在您系统的默认位置找到 Chrome 二进制文件。

您可以使用 chrome 选项来定义 google chrome 位置,如下所示:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = webdriver.ChromeOptions()
options.binary_location = "C:\Program Files\Google\Chrome\Application\chrome.exe"
driver = webdriver.Chrome(options = options, executable_path = r'C:\Users\VANIKO\Desktop\chromedriver.exe')
driver.get('http://google.com/')