0

I want to login into gmail with an account and perform some actions and sign out of it and login with different account(from my account list) but this time with different originating IP.

 with open('mygmailAccounts.json', 'r') as f:    
    accountsList = json.loads(f.read())

 driver = webdriver.Firefox();
 for eachaccount in accountlist:
    gmail_Login();

Is it possible that when script try to login with different account, call should go with different IP? Any help will highly appreciated.

2

1 Answer 1

1

Use a proxy server, like this with chromedriver and Python

options = Options()
options.add_argument('--proxy-server=46.102.106.37:13228')
browser = webdriver.Chrome(executable_path='ChromeDriverPath', chrome_options=options)

options = Options()
options.add_argument('--proxy-server=46.102.106.37:13228')
browser = webdriver.Chrome(executable_path='ChromeDriverPath', chrome_options=options)
2
  • Both set looks identical. is this how I should use it?? Also, please confirm if this proxy snippet will switch the driver to new IP on each call? Commented Apr 21, 2018 at 17:59
  • I believe these options work for a browser session.
    – Alexey R.
    Commented Apr 23, 2018 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.