当前位置: 首页 > news >正文

selenium学习笔记

一.搭建环境

1.安装chrome

#下载chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb#安装chrome
apt --fix-broken install ./google-chrome-stable_current_amd64.deb

2.安装chromedriver

首先先查看版本:google-chrome --version

前往Chrome for Testing availability

 下载对应版本号的driver

#下载
wget https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.86/linux64/chrome-linux64.zip#执行
unzip chromedriver-linux64.zip
cd chromedriver-linux64
mv chromedriver /usr/bin

3.核对版本号是否一致

#
google-chrome --version
#
chromedriver --version

4.调试

from selenium import webdriver                                        chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--disable-dev-shm-usage')driver = webdriver.Chrome(options=chrome_options)
url = "https://baidu.com"
driver.get(url)
print(driver.title)

http://www.lryc.cn/news/518970.html

相关文章:

  • asp.net core webapi 并发请求时 怎么保证实时获取的用户信息是此次请求的?
  • 实时数仓:基于数据湖的实时数仓与数据治理架构
  • STM32 拓展 RTC案例1:使用闹钟唤醒待机模式 (HAL库)
  • ESP32S3使用串口0作为LOG输出
  • Linux:深入了解fd文件描述符
  • springboot 集成 etcd
  • 03_Redis基本操作
  • pycharm-pyspark 环境安装
  • Unity + Firebase + GoogleSignIn 导入问题
  • web-app uniapp监测屏幕大小的变化对数组一行展示数据作相应处理
  • 2025年VGC大众汽车科技社招入职测评综合能力英语口语SHL历年真题汇总、考情分析
  • Linux中配置Java环境变量
  • 完全自定义Qt翻译功能,不使用Qt Linguist的.ts 和 .qm类型翻译
  • 551 灌溉
  • php函数性能优化中应注意哪些问题
  • 安科瑞 Acrel-1000DP 分布式光伏监控系统在工业厂房分布式光伏发电项目中的应用
  • 鼠标自动移动防止锁屏的办公神器 —— 定时执行专家
  • 各种特种无人机快速发展,无人机反制技术面临挑战
  • 深入学习RabbitMQ的Direct Exchange(直连交换机)
  • HTML实战课堂之启动动画弹窗
  • 将本地的 Git 仓库上传到 GitHub 上(github没有该仓库)
  • 【Linux】模拟Shell命令行解释器
  • G-Star Landscape 2.0 重磅发布,助力开源生态再升级
  • Lianwei 安全周报|2024.1.7
  • ASP.NET Core 实现微服务 - Consul 配置中心
  • 使用redis的5种常用场景
  • 微信小程序防止重复点击事件
  • PySpark用sort-merge join解决数据倾斜的完整案例
  • sklearn-逻辑回归-制作评分卡
  • scrapy爬取图片