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

相关推荐
想要成为祖国的花朵5 分钟前
基于多设计模式的抽奖系统__测试报告
java·selenium·测试工具·jmeter·设计模式·测试用例·安全性测试
Sally_xy1 小时前
Python 虚拟环境
开发语言·chrome·python
lakernote2 小时前
别再纠结 Postman 和 Apifox 了!这款开源神器让 API 测试更简单
测试工具·开源·postman
程序员威子2 小时前
最强平替Postman的工具,拒绝浏览器套壳
功能测试·selenium·测试工具·jmeter·单元测试·测试用例·postman
骑着蜗牛百米冲刺2 小时前
Postman自动化测试自动填充token
测试工具·lua·postman
黑客-秋凌2 小时前
接口测试工具(postman)
自动化测试·软件测试·测试工具·集成测试·lua·postman
Code哈哈笑2 小时前
解锁 Postman:下载安装与账户注册使用的全攻略,踏上测试新征程
测试工具·postman·web
测试界媛姐2 小时前
掌握Postman,开启API测试新纪元!
测试工具·lua·postman
测试开发技术2 小时前
Postman 如何切换为中文版?(保姆级教程)
测试工具·postman
豌豆1233212 小时前
Postman怎么将接口自动跑多次?并举例
测试工具·postman