'How to open url with selenium webdriver python with differents IPs?

from selenium import webdriver

options = webdriver.ChromeOptions()

options.add_argument('--proxy-server=125.62.213.229:82')
browser = webdriver.Chrome(executable_path='F:\Drivers\ChromeDriver\chromedriver.exe', chrome_options=options)

browser.get("http://www.whatismyipaddress.com")

I dont know to apply loop in this.



Solution 1:[1]

using .format to substitute.

ip=['125.62.213.229:82'] # add others here.
for i in ip:
    options.add_argument(('--proxy-server={0}').format(i))
    #rest of your code

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Linda