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)

相关推荐
Dxy123931021627 分钟前
python创建一个excel文件
开发语言·python·excel
朝朝又沐沐33 分钟前
算法竞赛阶段二-数据结构(40)数据结构栈的STL
开发语言·数据结构·c++·算法
比特森林探险记1 小时前
Go语言常用的设计模式
开发语言·设计模式·golang
深海潜水员1 小时前
【Unity】背包系统 + 物品管理窗口 (上)
开发语言·vscode·游戏·unity·c#·游戏引擎
德育处主任Pro2 小时前
p5.js 用 beginGeometry () 和 endGeometry () 打造自定义 3D 模型
开发语言·javascript·3d
kyranhan2 小时前
C#程序本地运行正常,通过网络下载报错:FileLoadException:“未能加载文件或程序集“xxx.dll”或它的某一个依赖项。
开发语言·c#·wpf
涡能增压发动积3 小时前
Browser-Use Agent使用初体验
人工智能·后端·python
重生之我是Java开发战士3 小时前
【C语言】结构体详解
c语言·开发语言
先鱼鲨生3 小时前
gtest框架的安装与使用
开发语言·apache