from selenium import webdriver
from selenium.webdriver.common.keys import Keys
Game_Pin = input('Enter your PIN: ')
NickNAME = input('Enter your nickname: ')
def Enter_Press():
selenium.find_element_by_name("Enter").click()
def Kahoot_Spammer(Game_Pin, NickNAME):
chromedriver = ('C:\\Users\\ovvip\\Downloads\\chromedriver_win32.zip')
browser = webdriver.Chrome(chromedriver)
browser.get('https://kahoot.it/')
game_pin = selenium.find_element_by_id("Game PIN")
Name = selenium.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来说,我是初学者,所以这段代码可能会有很多错误,并且可以更有效地编写。无论如何,每当我运行程序一直在寻找答案时,我一直都会收到此错误,并且想知道是否有人知道这里发生了什么。我已经从64位python切换到32位,看看chromedriver(据我所知只有32位)是否导致了64位Python的任何问题,我得到了完全相同的错误。任何帮助表示赞赏。
Traceback (most recent call last):
File "C:/Users/ovvip/AppData/Local/Programs/Python/Python36-32/KahootSpammer.py", line 27, in <module>
Kahoot_Spammer(Game_Pin, NickNAME)
File "C:/Users/ovvip/AppData/Local/Programs/Python/Python36-32/KahootSpammer.py", line 13, in Kahoot_Spammer
browser = webdriver.Chrome(chromedriver)
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 68, in __init__
self.service.start()
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\ovvip\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
答案 0 :(得分:0)
我认为这是因为你没有先解压缩chrome驱动程序。
试试看它是否有效:
cd
到此文件夹:C:\Users\ovvip\Downloads\
chromedriver_win32.zip
文件Kahoot_Spammer
函数中C:\\Users\\ovvip\\Downloads\\chromedriver.exe