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

相关推荐
测试199816 小时前
Appium使用指南与自动化测试案例详解
自动化测试·软件测试·python·测试工具·职场和发展·appium·测试用例
李少兄1 天前
解决 Chrome 下载 `.crx` 文件被自动删除及“无法安装扩展程序,因为它使用了不受支持的清单版本”问题
前端·chrome
草明1 天前
Chrome HSTS(HTTP Strict Transport Security)
前端·chrome·http
程序员三藏2 天前
快速弄懂POM设计模式
自动化测试·软件测试·python·selenium·测试工具·设计模式·职场和发展
wufeng无峰2 天前
谷歌浏览器Google Chrome离线安装包
chrome·离线安装包
c0detrend2 天前
读诗的时候我却使用了自己研发的Chrome元素截图插件
前端·chrome
程序员三藏2 天前
使用Docker和Selenium构建自动化测试环境
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
让世界再也没有bug2 天前
JMeter与Postman的区别
测试工具·jmeter·postman
优测云服务平台2 天前
质效飞跃,优测金融数智质效解决方案全新升级!
测试工具·金融
newxtc2 天前
【河北政务服务网-注册_登录安全分析报告】
人工智能·selenium·安全·yolo·政务·安全爆破