不安全无数据块在chrome浏览器中自动化执行

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

我在selenium 4.16.0,chrome-120.0.6099.217中使用了上面的代码

from selenium.webdriver.edge.service import Service

service_obj = Service()

driver = webdriver.Chrome(service=service_obj)

driver.get("https://google.com")
python-3.x selenium-webdriver
1个回答
0
投票

我不确定您是否发布了完整的代码,无论如何,您还应该包含一个

Options()
对象并 为您的浏览器使用正确的
Options
Service
(导入)。

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service

driver = webdriver.Chrome(options=Options(), service=Service())
driver.get("https://google.com")
© www.soinside.com 2019 - 2024. All rights reserved.