我试图使一个自动化项目,将使用代理注册在一个网站。但我无法得到它的工作。
我已经尝试了selenium-wire代理身份验证,但仍然不起作用
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
import os
import keyboard
import pyautogui
from time import sleep
user = 'jesbeqki'
pwd = '1wbt8dnqtu8w'
end = '2.56.119.93:5074'
seleniumwire_options ={
"proxies" : {
"https": "http://"f"{user}:{pwd}@{end}/",
"http": "http://"f"{user}:{pwd}@{end}/",
'verify_ssl': False
}
}
firefox_options = Options()
# firefox_options.add_argument("--headless")
driver = webdriver.Firefox(options=firefox_options, seleniumwire_options=seleniumwire_options)
driver.get('https://httpbin.org/ip')
text = driver.find_element(By.TAG_NAME, 'body').text
print(text)
字符串
显示的是我的原始IP。
2条答案
按热度按时间fiei3ece1#
您可以使用SeleniumBase代理到站点。
pip install seleniumbase
,然后在填写代理详细信息后使用python
运行以下命令:字符串
9o685dep2#
你可以尝试像这样添加代理配置:
字符串