Windows 安装 chromedriver 和 Python 调试

下载 chromedriver

从官方网站上下载 chromedriver 的版本,这个版本需要和你 Chrome 的版本对应上。

下载的地址为:ChromeDriver - WebDriver for Chrome - Downloads

这个地方,将会打开一个新的浏览器界面,Chrome for Testing availability

在这个新的浏览器界面中,我们能看到对应的 Chrome 版本号。

查看 Chrome 版本

通过查看 Chrome 的版本来查看关于的信息。

通过这个 Chrome 的版本来下载 chromedriver 的版本。

解压到特定目录

解压到特定的目录后就可以使用了。

Python 代码

如果需要在 python 中直接进行使用。

需要导入的包:

复制代码
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

使用代码来进行运行浏览器

复制代码
chrome = Chrome(service=Service(r"C:\Users\yhu\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe"))
chrome.get('https://www.isharkfly.com/')

通过上面的代码就可以在 chromedriver 上打开浏览器后查看下载的原始内容。

如果你有 IDE 的断点调试功能的话,这个使用应该可以查看断点中的内容。

上图是运行代码后,通过断点查看对象中访问网站的内容。

Windows 安装 chromedriver 和 Python 调试 - Python - iSharkFly

相关推荐
ZhengEnCi2 小时前
P2M-Matplotlib折线图完全指南-从数据可视化到趋势分析的Python绘图利器
python·matlab·数据可视化
ZhengEnCi4 小时前
P2L-Matplotlib饼图完全指南-从数据可视化到图表定制的Python绘图利器
python·matlab
曲幽4 小时前
你的REST接口还在“过度投喂”数据吗?——FastAPI + GraphQL实战避坑指南
python·fastapi·web·graphql·route·cors·rest·strawberry
用户8358086187915 小时前
基于 Self-RAG 与列表级重排序的进阶 RAG 系统设计与实现
python
Warson_L1 天前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅1 天前
海天线算法的前世今生
python·计算机视觉
韩师傅1 天前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L1 天前
LangGraph的MessageState and HumanMessage
python
韩师傅1 天前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
Warson_L1 天前
python的类&继承
python