Selenium Wire webdriver 无法浏览网站

问题描述 投票:0回答:1

我正在使用 Python 和 Selenium (selenium-wire) 自动控制两个站点的浏览器。 浏览大多数网站,例如: https://www.google.com
https://platform.cmcmarkets.com/
在 seleniumwire 下使用 chromedriver 效果很好。

但是,当浏览到: https://app.plus500.com/

将显示 Chrome 错误页面,并显示以下消息:

This site can’t be reached  
The web page at https://app.plus500.com/ might be temporarily down or it may have moved permanently to a new web address.
ERR_HTTP2_PROTOCOL_ERROR

selenium-wire 是一个 Python 模块,它通过允许捕获请求和响应来扩展 selenium。 可以使用普通的 selenium webdrivers 访问该网站,因此问题似乎在于使用的 selenium-wire 包。

将 selenium-wire 颁发的根权限证书导入 Chrome 中,可以浏览 HTTPS 站点,而不会阻止“您的连接不是私有的”屏幕。

奇怪的是,虽然 google.com(和其他网站)的证书查看器显示 Selenium Wire CA:

Common Name (CN)    www.google.com
Organisation (O)    <Not part of certificate>
Organisational Unit (OU)    <Not part of certificate>
Common Name (CN)    Selenium Wire CA
Organisation (O)    <Not part of certificate>
Organisational Unit (OU)    <Not part of certificate>

app.plus500.com 不:

Common Name (CN)    *.plus500.com
Organisation (O)    Edgio, Inc.
Organisational Unit (OU)    <Not part of certificate>
Common Name (CN)    DigiCert Global G2 TLS RSA SHA256 2020 CA1
Organisation (O)    DigiCert Inc
Organisational Unit (OU)    <Not part of certificate>

plus500.com 网站随后报告我处于离线状态,可能是因为某些应用程序资产无法加载。但是它确实报告证书有效,因此这似乎不是问题。

我尝试在 selenium-wire 选项中切换 mitmproxy 后端也没有成功。

端口 443 上服务器的数据包捕获显示失败的连接序列与来自服务器的一些额外的 TCP RST 相对应,但我无法从中解释太多其他内容。

请任何诊断此问题的帮助都会很棒!

python selenium-webdriver http2 mitmproxy seleniumwire
1个回答
0
投票

按照 seleniumwire 作者针对类似问题的建议,在

mitm_http2
内禁用
seleniumwire_options

seleniumwire_options = {
    'mitm_http2': False,
}

在这种情况下对我不起作用。

在我的 chromedriver 实例中禁用 HTTP2 是我解决的解决方法:

chrome_options.add_argument('--disable-http2')
© www.soinside.com 2019 - 2024. All rights reserved.