巧克力安装上周开始失败。Dockerfile 开头为
FROM python:3.8.2-windowsservercore-ltsc2016
SHELL ["powershell","-Command"]
RUN "Set-ExecutionPolicy Bypass -Scope Process -Force; [Net.ServicePointManager]::SecurityProtocol = 'tls12'; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
Run Code Online (Sandbox Code Playgroud)
日志说:
Forcing web requests to allow TLS v1.2 (Required for requests to Chocolatey.org)
Getting latest version of the Chocolatey package for download.
Not using proxy.
Getting Chocolatey from https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0.
Downloading https://community.chocolatey.org/api/v2/package/chocolatey/2.0.0 to C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip
Not using proxy.
Extracting C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\chocoInstall\chocolatey.zip to C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey\chocoInstall
Installing Chocolatey on the local machine
The registry key for .Net 4.8 was not found or this is forced
Downloading 'https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe' to …Run Code Online (Sandbox Code Playgroud) 我想这应该有效:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option('same-site-by-default-cookies', 'true')
driver = webdriver.Chrome(chrome_options=options)
Run Code Online (Sandbox Code Playgroud)
启用为未来 chrome 版本计划的相同站点 cookie 限制。不是,有错误:
selenium.common.exceptions.InvalidArgumentException:
Message: invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: unrecognized chrome option: same-site-by-default-cookies
Run Code Online (Sandbox Code Playgroud)
我可以使用 chrome://flags 手动更改选项并查看它是否正常工作。但是我想自动化它并运行测试脚本来查看它。
这里有 java 代码:https : //groups.google.com/forum/#!topic/ chromedriver-users/ cI8hj7eihRo 可以做到,但我不确定如何将其传输到 python。
是否有任何参考资料可以帮助我设置此选项或其他选项?
selenium google-chrome python-3.x selenium-chromedriver samesite