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

相关推荐
可可南木12 小时前
3070文件格式--2--board文件格式详解 2
功能测试·测试工具·pcb工艺
测试老哥14 小时前
2026最新软件测试面试热点问题(含答案+文档)
自动化测试·软件测试·python·测试工具·面试·职场和发展·测试用例
sww_102615 小时前
JVM基础学习
jvm·学习·测试工具
ysn1111115 小时前
.NET性能测试工具BenchmarkDotNet
测试工具·c#
天才测试猿16 小时前
自动化测试基础知识总结
自动化测试·软件测试·python·测试工具·程序人生·职场和发展·测试用例
卓码软件测评16 小时前
CMA/CNAS双资质软件测评机构【Apifox高效编写自动化测试用例的技巧和规范】
测试工具·ci/cd·性能优化·单元测试·测试用例
winfredzhang17 小时前
从零构建:手写一个支持“高度定制化排版”的 Chrome 网页摘录插件
chrome·pdf·插件·epub·零碎信息归档
测试秃头怪17 小时前
支付宝性能测试案例分析详解
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·性能测试
祎直向前19 小时前
linuxshell测试题
前端·chrome