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

相关推荐
青青子衿_213 小时前
TikTok爬取——视频、元数据、一级评论
爬虫·python·selenium
spencer_tseng8 小时前
Chrome settings for opening new tags
chrome
ToDetect17 小时前
主流Chrome、Edge、Firefox 浏览器 User-Agent 解析完整操作指南
chrome·todetect·浏览器指纹检测·user-agent 解析
守城小轩19 小时前
Chromium 140 编译指南 macOS 篇:基础环境准备(一)
chrome·macos·chrome devtools·指纹浏览器·浏览器开发·超级浏览器
程序员小远1 天前
Appium-移动端自动测试框架详解
自动化测试·软件测试·python·测试工具·职场和发展·appium·测试用例
johnny2331 天前
AI加持测试工具汇总:Strix、
人工智能·测试工具
韩师学子--小倪1 天前
tcpdump + Wireshark:抓取nginx转发到服务的流量
测试工具·nginx·tcpdump
百花~1 天前
自动化测试概念篇~
selenium·log4j
二哈喇子!1 天前
在 Chrome 里通过 ZeroOmega 插件,接入亮数据的数据中心代理 IP
chrome·ai·代理ip·zeroomega插件·亮数据的数据中心代理方案