web自动化使用selenium库怎么去除自动化标识,禁止浏览器关闭窗口以及关闭保存密码提示框

from selenium import webdriver

from selenium.webdriver.chrome.options import Options as CHOptions

from selenium.webdriver.edge.options import Options as EDOptions

1、不要自动关闭浏览器

复制代码
option = EDOptions()
option.add_experimental_option('detach', True)
# 2、去掉自动化标识
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_argument('--disable-blink-features=AutomationControlled')
# 3、关闭保存密码弹窗
prefs = {}
prefs['credentials_enable_service'] = False
prefs['profile.password_manager_enabled'] = False
option.add_experimental_option('prefs', prefs)
self.driver = webdriver.Edge(options=option)
复制代码
复制代码
相关推荐
时间的情敌3 分钟前
Vue3的异步DOM更新:nextTick的正确使用方法
前端·javascript·vue.js
Run Freely9377 分钟前
web自动化测试-Selenium04_iframe切换、窗口切换
selenium
风语者日志10 分钟前
[LitCTF 2023]作业管理系统
前端·网络·安全·web安全·ctf
excel20 分钟前
深入解析:Vue 编译器核心工具函数源码(compiler-core/utils.ts)
前端
excel21 分钟前
第五章:辅助函数与全流程整合
前端
excel22 分钟前
🔍 深度解析:Vue 编译器中的 validateBrowserExpression 表达式校验机制
前端
excel22 分钟前
深度解析:Vue 模板编译器中的 Tokenizer 实现原理
前端
excel25 分钟前
🧩 Vue 编译核心:transform.ts 源码深度剖析
前端
excel25 分钟前
Vue Runtime Helper 常量与注册机制源码解析
前端
excel28 分钟前
Vue 模板编译器核心选项解析:从 Parser 到 Codegen 的全链路设计
前端