from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
Game_Pin = input('Enter your PIN: ')
NickNAME = input('Enter your nickname: ')
def Enter_Press():
browser.find_element_by_name("Enter").click()
def Kahoot_Spammer(Game_Pin, NickNAME):
chromedriver = os.chdir(r'C:\WebDriver\bin\chromedriver_win32.exe')
browser = webdriver.Chrome(chromedriver)
browser.get('https://kahoot.it/')
game_pin = browser.find_element_by_id("Game PIN")
Name = browser.find_element_by_id("Nickname")
game_pin.send_keys(Game_Pin)
Enter_Press()
Name.send_keys(NickNAME)
Enter_Press()
Kahoot_Spammer(Game_Pin, NickNAME)
我是Python编程和编程的新手。无论如何,我一直在寻找一个明确的答案,为什么它现在已经工作了很长一段时间。我很确定我在PATH中有文件,但由于某种原因它仍然无法找到它。这是我不断得到的错误。任何想法
Traceback (most recent call last):
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\KahootSpammer.py", line 28, in <module>
Kahoot_Spammer(Game_Pin, NickNAME)
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\KahootSpammer.py", line 13, in Kahoot_Spammer
chromedriver = os.chdir(r'C:\WebDriver\bin\chromedriver_win32.exe')
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\WebDriver\\bin\\chromedriver_win32.exe'
答案 0 :(得分:0)
os.chdir
changes the current directory指定的一个。你不需要去目录,你只需要告诉selenium它在哪里。
删除这两行代码并添加它应该有效:
webdriver.Chrome(r'C:\WebDriver\bin\chromedriver_win32.exe')