【发布时间】:2019-09-23 06:18:48
【问题描述】:
我正在尝试制作一个可用作 instagram.com 模块的 Python 程序。代码如下:
from selenium import webdriver
from getpass import getpass
user = input("Enter your username/email: ")
pwd = getpass(prompt="Enter your password: ")
driver = webdriver.Chrome()
driver.get("https://www.instagram.com/accounts/login/")
usr_box = driver.find_element_by_class_name("_2hvTZ.pexuQ.zyHYP")
usr_box.send_keys(user)
执行此操作后出现错误:
Traceback (most recent call last):
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 769, in __init__
restore_signals, start_new_session)
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1172, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\***\OneDrive\Desktop\Desktop\Python\Projects\Instagram Module.py", line 7, in <module>
driver = webdriver.Chrome()
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\***\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 83, 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/home
【问题讨论】:
-
那么 chromedriver 在你的路径上吗?
-
我运行了 .exe 但我不确定如何将它添加到我的路径中
-
您是否尝试搜索例如“Windows 将可执行文件添加到路径”?
标签: python python-3.x selenium getpass