wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.9k stars 254 forks source link

I changed to proxy, but the IP change does not happen #565

Closed vladsuxunun closed 2 years ago

vladsuxunun commented 2 years ago

I changed to proxy, but the IP change does not happen

Originally posted by @vladsuxunun in https://github.com/wkeeling/selenium-wire/issues/557#issuecomment-1159778132

vladsuxunun commented 2 years ago

import imp from webbrowser import Chrome from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options as chromeOptions from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from seleniumwire import webdriver from webdriver_manager.chrome import ChromeDriverManager import time import random import requests import pickle

driver = webdriver.Chrome()

options = { 'proxy': { 'https': 'socks5://#######@waw.socks.ipvanish.com:1080',

} 
}

chrome_options = chromeOptions() driver = webdriver.Chrome(ChromeDriverManager().install(),seleniumwire_options=options) service_args = ['--proxy=waw.socks.ipvanish.com:1080', '--proxy-type=socks5', '--proxy-auth=#######'] driver.get("https://api.myip.com/") time.sleep(4) driver.proxy = { 'https': 'socks5://######@mad.socks.ipvanish.com:1080', } time.sleep(10) print("prpxy") driver.get("https://api.myip.com/") time.sleep(45) driver.proxy = { 'https': 'socks5://###########@mad.socks.ipvanish.com:1080', } time.sleep(3) driver.get("https://api.myip.com/") driver.proxy = { 'https': 'socks5://######@mad.socks.ipvanish.com:1080', } time.sleep(3) driver.get("https://api.myip.com/") time.sleep(240) print("save")

wkeeling commented 2 years ago

OK I can see the problem. The socks proxy will only change when the address (host/port) of the proxy changes in driver.proxy. But it looks as though the address is always set to mad.socks.ipvanish.com:1080.