selenium在option里加代理
时间: 2023-07-12 21:20:48 浏览: 104
如果您想在Selenium的Options中加入代理,可以使用以下Python代码:
```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
PROXY_HOST = 'xxx.xxx.xxx.xxx' # 输入您的代理IP地址
PROXY_PORT = 'xxxx' # 输入您的代理端口号
chrome_options = Options()
chrome_options.add_argument('--proxy-server=http://{}:{}'.format(PROXY_HOST, PROXY_PORT))
driver = webdriver.Chrome(options=chrome_options)
```
您需要将代理IP和端口替换为您的具体信息,这样就可以在Selenium的Options中加入代理来运行Chrome浏览器。
阅读全文
相关推荐









