gpt4 book ai didi

Python Selenium : OSError: [WinError 193] %1 is not a valid Win32 application

转载 作者:行者123 更新时间:2023-12-01 09:25:36 33 4
gpt4 key购买 nike

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

最佳答案

我认为这是因为您没有先解压 chrome 驱动程序。

尝试一下看看它是否有效:

  1. cd 到此文件夹:C:\Users\ovvip\Downloads\
  2. 解压 chromedriver_win32.zip 文件
  3. Kahoot_Spammer 函数中,将文件路径更改为解压文件:C:\\Users\\ovvip\\Downloads\\chromedriver.exe

关于Python Selenium : OSError: [WinError 193] %1 is not a valid Win32 application,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50420799/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com