【发布时间】:2022-11-03 09:32:31
【问题描述】:
我在我的项目中使用硒和硒线。 我正在编写流程以登录到 aws 和 gcp 门户。 我的流程运行良好,但是当我进入 aws/gcp 门户时出现错误,我看到空白页..
aws 门户 链接:https://us-east-1.console.aws.amazon.com/console/home?region=us-east-1#
硒驱动程序 `
from seleniumwire import webdriver
from seleniumwire.webdriver import ChromeOptions
def test_aws_flow():
options = ChromeOptions()
options.add_experimental_option("detach", True)
options.add_argument('--no-sandbox')
options.add_argument('--single-process')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--start-maximized")
options.add_argument('--auto-open-devtools-for-tabs')
options.add_argument('--log-level=2')
options.add_argument('--disable-features=IsolateOrigins,site-per-process')
options.add_argument("--ignore_ssl")
options.add_argument('--ignore-ssl-errors')
options.add_argument('--ignore-certificate-errors')
options.add_argument("--disable-extensions")
options.add_argument("--disable-setuid-sandbox")
options.add_argument("--dns-prefetch-disable")
options.add_argument('ignore-certificate-errors')
options.add_argument('disable-web-security')
options.add_argument('--allow-insecure-localhost')
driver = webdriver.Chrome(options=options)
driver.get('....any-hidden-url')
# more flow actions - then it open aws portal
`
我在 github 中发现了一些对我不起作用的库 selenium 线的问题。 https://github.com/wkeeling/selenium-wire/issues/566
- 他们建议与未检测到的 bot chromedriver 一起使用,我尝试过,但仍然显示相同的问题。
一些更新
我添加了 openssl.cnf 并在我的测试中使用 pycharm 在本地运行它
openssl_conf = openssl_init
[openssl_init]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
Options = UnsafeLegacyRenegotiation
它成功登录到 gcp 和 aws ..为什么会这样?当我将它部署到 aws lambda 时,如何确保它不会在 prod 环境中发生?
【问题讨论】:
标签: selenium selenium-webdriver selenium-chromedriver ui-automation e2e-testing