【问题标题】:Python Selenuim CrashesPython Selenium 崩溃
【发布时间】:2021-08-29 06:07:20
【问题描述】:

当我运行我的代码时它崩溃了,请帮忙,这是在深夜制作的,所以我可能错过了一些 obv。我没有像我的其他程序那样启动 chrome 驱动程序,而是让它运行实际的 chrome。有解决办法吗?

from selenium.webdriver.common.proxy import Proxy, ProxyType
import time

# change 'ip:port' with your proxy's ip and port
proxy_ip_port = '95.217.168.246:8888'

proxy = Proxy()
proxy.proxy_type = ProxyType.MANUAL
proxy.http_proxy = proxy_ip_port
proxy.ssl_proxy = proxy_ip_port

capabilities = webdriver.DesiredCapabilities.CHROME
proxy.add_to_capabilities(capabilities)

# replace 'your_absolute_path' with your chrome binary absolute path
driver = webdriver.Chrome(r'C:\Users\andre\Desktop\Python dsicord bot\chromedriver',
                          desired_capabilities=capabilities)

driver.get('http://whatismyipaddress.com')

time.sleep(8)```






**Error:** 

```DevTools listening on ws://127.0.0.1:57598/devtools/browser/120e371a-b935-4d04-9057-de3f728ce8b0
Traceback (most recent call last):
  File "c:\Users\andre\Desktop\Python dsicord bot\sys.py", line 17, in <module>
    driver = webdriver.Chrome(r'C:\Users\andre\Desktop\Python dsicord bot\chromedriver',
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 93
Current browser version is 92.0.4515.159 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe```

【问题讨论】:

    标签: selenium google-chrome selenium-webdriver


    【解决方案1】:

    这个错误:

    selenium.common.exceptions.SessionNotCreatedException: Message: session not created:This version of ChromeDriver only supports Chrome version 93
    

    基本上是你没有兼容版本的浏览器和浏览器驱动。

    截至 2021 年 8 月 29 日

    Latest stable release: ChromeDriver 92.0.4515.107
    

    Google chrome 浏览器版本为Version 92.0.4515.159 (Official Build) (64-bit)

    为 chromedriver 下载 link,尝试获取 92.0,这应该可以帮助您解决这个问题。

    【讨论】:

    • 我知道你有,但它是93,这是一个beat版本不稳定版本,你应该使用92,看看是否有帮助,我一直在上面给你一个链接,你可以从那里下载.此外,还有一个自动安装程序,如果您也想在您的机器人中使用该功能,请告诉我。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-30
    • 1970-01-01
    相关资源
    最近更新 更多