记录selenium和chrome使用socks代理打开网页以及查看selenium的版本

使用前,首先打开socks5全局代理。 之前我还写过一篇关于编程中使用到代理的情况:

记录一下python编程中需要使用代理的解决方法_python 使用全局代理_小小爬虾的博客-CSDN博客

在本文中,首先安装selenium和安装chrome浏览器。

参考我的文章python3如何安装各类库的小总结_小小爬虾的博客-CSDN博客

复制代码
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

#socks代理
host='127.0.0.1'
port='10808'
chrome_options = Options()
chrome_options.add_argument("--proxy-server=socks5://" + host + ":" + port)

# driver = webdriver.Chrome(chrome_options=chrome_options)#低版本的selenium使用的是chrome_options=chrome_options
driver = webdriver.Chrome(options=chrome_options)#高版本的selenium使用的是options=chrome_options
url = "https://www.google.com"
driver.maximize_window() #浏览器最大化
driver.get(url)
time.sleep(10)

那么,如何查看selenium的版本呢?

1、运行cmd,进入到pip3.exe的路径

cd C:\Users\LC\AppData\Local\Programs\Python\Python310\Scripts

2、在路径下运行pip3.exe show selenium

相关推荐
0思必得015 分钟前
[Web自动化] Selenium处理滚动条
前端·爬虫·python·selenium·自动化
csdn_life1827 分钟前
openclaw mcporter 操作 chome 在 window10/linux chrome-devtools-mcp
chrome·mcp·openclaw
辣香牛肉面5 小时前
Wireshark v4.6.2 开源免费网络嗅探抓包工具中文便携版
网络·测试工具·wireshark
龙飞056 小时前
Systemd -systemctl - journalctl 速查表:服务管理 + 日志排障
linux·运维·前端·chrome·systemctl·journalctl
zhengfei61121 小时前
面向攻击性安全专业人员的一体化浏览器扩展程序[特殊字符]
前端·chrome·safari
测试工程师成长之路1 天前
Serenity BDD 框架:Java + Selenium 全面指南(2026 最新)
java·开发语言·selenium
may_一一1 天前
xpath定位:selenium和playwrightAnt Design / 表单类页面)
selenium·测试工具
daopuyun1 天前
CNAS/CMA软件检测实验室源代码漏洞测试工具选型要求与比对
软件测试·测试工具·软件检测·cnas认可·cma认定
老师用之于民1 天前
【DAY21】Linux软件编程基础&Shell 命令、脚本及系统管理实操
linux·运维·chrome·经验分享·笔记·ubuntu
扶苏10021 天前
vue使用event.dataTransfer实现A容器数据拖拽复制到到B容器
前端·vue.js·chrome