selenium 使用方法

from selenium import webdriver

from selenium.webdriver.chrome.service import Service

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

chrome_options = webdriver.ChromeOptions()

chrome_options.add_experimental_option(

"excludeSwitches", "enable-automation")

chrome_options.add_experimental_option('useAutomationExtension', False)

chrome_options.add_argument('lang=zh-CN,zh,zh-TW,en-US,en')

chrome_options.add_argument(

'user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36')

chrome_options.add_argument("disable-blink-features=AutomationControlled")

#chrome_options.add_argument('--headless')

chrome_options.add_argument('--disable-javascript')

driver_path='E:\chrome\chrome-win64\chrome-win64\chromedriver.exe'

service = Service(executable_path=driver_path)

d=webdriver.Chrome(service=service)

d.get(url)

相关推荐
superrick3 分钟前
MCP 协议深度解析:AI Agent 的工具集成标准
python
小灰灰搞电子11 分钟前
Qt 队列容器 QQueue 的详解与示例
开发语言·qt·qqueue
淼澄研学28 分钟前
Python自动化办公实操:基于pandas与requests的5个提效场景解析
python·自动化·pandas
ACP广源盛1392462567336 分钟前
GSV6155@ACP# Type-C 视频信号转换芯片:技术架构、工程痛点适配与落地场景分析
大数据·c语言·开发语言·人工智能·分布式·嵌入式硬件·架构
程序员-Benothing43 分钟前
Java集合:List实现类深度对比
java·开发语言·后端·面试·list
酷在前行1 小时前
【R论文复刻】Nature Communications 冲积图进阶:状态转移、流带排序与多面板排版(保姆级教程)
开发语言·r语言
薛少杰1 小时前
Python异步系统学习路线第59讲_核心原理与实战案例详解【技巧】
python·事件循环·异步编程·实战案例·协程调度
减瓦1 小时前
用 Git 为本地文件打造一台时光机
开发语言·git·编辑器
一次旅行1 小时前
fzf+ripgrep+fd终端三合一实战:一套检索工具链,大幅提升大型项目开发效率
人工智能·python·github