gpt4 book ai didi

python - 如何从 selenium 在 Chrome 中启用 "allow-insecure-localhost"标志?

转载 作者:太空宇宙 更新时间:2023-11-03 14:44:31 24 4
gpt4 key购买 nike

我想从 selenium 中启用“allow-insecure-localhost”标志。
我该怎么做?

Selenium :3.12.0,Python:3.6.5

Chrome 驱动程序创建代码:

def create_driver():
options = Options()
if sys.platform == "darwin":
options.binary_location = '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
options.add_experimental_option("detach", True)
options.add_argument('allow-insecure-localhost') # I tried to be enable, but it does not affect to chrome.
if sys.platform == "win32":
chromedriver_path = r".\chromedriver"
else:
chromedriver_path = "../chromedriver"
driver = webdriver.Chrome(chromedriver_path, chrome_options=options)
return driver

最佳答案

看来你们很接近。根据文档 --allow-insecure-localhost应在 -- 之前,如下所示:

options.add_argument('--allow-insecure-localhost')

--allow-insecure-localhost : Enables TLS/SSL errors on localhost to be ignored (no interstitial, no blocking of requests)

关于python - 如何从 selenium 在 Chrome 中启用 "allow-insecure-localhost"标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50838882/

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