I have a bunch of questions, please answer them or any known
Question 1:
How to change proxy settings after chrome has been launched?
Reason:
Infact, what I want is, I can't wait for chrome to relaunch to change proxy setting everytime, I want some code to be injected in inspect or use any selenium driver method for changing proxy this is possible in normal chrome using extensions but chromedriver can't click on extension also it is not the most convenient way as my vpn does not have chrome extension
Question 2:
Is it possible to add a list of proxies to auto rotate for every website open?
Question 3:
Is it possible to run each chrome tab with seperate ip/proxy?
Question 4:
Can you tell me what matters the most running chrome flawlessly, multi-instances i.e, I want to run multiple tests at once maybe 100s, my RAM is 16gb but computer still become slow due to more instances, CPU i5 8th gen
CodePudding user response:
(1) Use like this
from selenium import webdriver
PROXY = "11.456.448.110:8080"
chrome_options = WebDriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("https://www.google.com")
(2)
Is it possible to add a list of proxies to auto rotate for every website open?
Yes and No. You must initialize new WebDriver instance. Yes, create new WebDriver instance, then open your web-page. No. You cannot change proxy after a WebDriver instance opened.
(3)
Is it possible to run each chrome tab with seperate ip/proxy?
No.
(4)
Can you tell me what matters the most running chrome flawlessly, multi-instances i.e, I want to run multiple tests at once maybe 100s, my RAM is 16gb but computer still become slow due to more instances, CPU i5 8th gen
Init many WebDriver, then put inside Python threads.
See