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)

相关推荐
databook15 小时前
Manim实现闪光轨迹特效
后端·python·动效
Juchecar16 小时前
解惑:NumPy 中 ndarray.ndim 到底是什么?
python
用户83562907805116 小时前
Python 删除 Excel 工作表中的空白行列
后端·python
Json_16 小时前
使用python-fastApi框架开发一个学校宿舍管理系统-前后端分离项目
后端·python·fastapi
数据智能老司机1 天前
精通 Python 设计模式——分布式系统模式
python·设计模式·架构
数据智能老司机1 天前
精通 Python 设计模式——并发与异步模式
python·设计模式·编程语言
数据智能老司机1 天前
精通 Python 设计模式——测试模式
python·设计模式·架构
数据智能老司机1 天前
精通 Python 设计模式——性能模式
python·设计模式·架构
c8i1 天前
drf初步梳理
python·django
每日AI新事件1 天前
python的异步函数
python