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)

相关推荐
u***32431 小时前
使用python进行PostgreSQL 数据库连接
数据库·python·postgresql
青瓷程序设计4 小时前
动物识别系统【最新版】Python+TensorFlow+Vue3+Django+人工智能+深度学习+卷积神经网络算法
人工智能·python·深度学习
tobebetter95274 小时前
How to manage python versions on windows
开发语言·windows·python
F_D_Z4 小时前
数据集相关类代码回顾理解 | sns.distplot\%matplotlib inline\sns.scatterplot
python·深度学习·matplotlib
9***P3345 小时前
PHP代码覆盖率
开发语言·php·代码覆盖率
daidaidaiyu5 小时前
一文入门 LangGraph 开发
python·ai
CoderYanger5 小时前
优选算法-栈:67.基本计算器Ⅱ
java·开发语言·算法·leetcode·职场和发展·1024程序员节
jllllyuz5 小时前
Matlab实现基于Matrix Pencil算法实现声源信号角度和时间估计
开发语言·算法·matlab
多多*5 小时前
Java复习 操作系统原理 计算机网络相关 2025年11月23日
java·开发语言·网络·算法·spring·microsoft·maven
p***43486 小时前
Rust网络编程模型
开发语言·网络·rust