记录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

相关推荐
2601_9622982718 分钟前
Python与Selenium结合的Web自动化测试全流程实践教程
自动化测试·python·selenium·web测试·pageobjectmodel
chuntian_tester3 小时前
AI自动化第3步【用例设计】
人工智能·测试工具·ai·自动化
广州文明机电有限公司4 小时前
LM‑2 实操|宽域氧传感器安装位置 + Free‑Air 自由空气校准完整流程
功能测试·测试工具
PhotonixBay5 小时前
共聚焦显微镜如何实现表面形貌测量
图像处理·测试工具·共聚焦显微镜·表面粗糙度·激光共聚焦显微镜·表面形貌
chuntian_tester5 小时前
AI自动化第1步【系统探索】
人工智能·测试工具·ai·自动化
2601_962298277 小时前
【自动化测试】基于Selenium + Python的web自动化框架
自动化测试·python·selenium·测试用例·web框架
2601_962295581 天前
python+selenium实现自动化测试
自动化测试·python·selenium·学习心得·web端测试
吴声子夜歌1 天前
Linux命令——学习Shell(三)
linux·chrome·学习
panic了再查1 天前
disable_reasons 里那一位早就置上了:把下架、禁用、装不上分成三层取证
chrome