0

I am making a bot in Python Selenium which is required to do the same job but with different countries IP addresses...I would like my bot to connect to any random IP Address of a specified country, start browsing, completes a job then connect with some other country random IP Address, do the same job and so on...

My Question is how to get the IP of any country in Python Selenium? Previously i have searched on Google and Stake Overflow but i can't get the exact result that i wanted to be..

Joe Ann
  • 15
  • 6
  • You will need a proxy for each country: https://stackoverflow.com/questions/11450158/how-do-i-set-proxy-for-chrome-in-python-webdriver – Vilius Klakauskas Oct 18 '19 at 15:02
  • Actually i want is that the bot will get connects to any random ip address of a country not to one ip address of country for task 1 and then similarly for task 2 it get connected with other random ip address of a country – Joe Ann Oct 18 '19 at 15:13

1 Answers1

0

You can use tor browser

https://www.torproject.org/download/

tor browser is a proxy web browser which switch to different country id in a interval.

Also tor is based on firefox so you need to setup all config as per Firefox including gecko driver.

code you can find below :

Using Selenium WebDriver with Tor

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
  • I don't want my ip address to change to different country id in a interval...What i want is once a bot complete one task, it can then change the proxy to some other country and do task 2 and so on – Joe Ann Oct 18 '19 at 15:11
  • you need to close the webdriver sessio ans start a new sessuin with new proxy ... place provy in some excel file and read new proxy each time... chagining session runtime is not possible in webdriver – Shubham Jain Oct 18 '19 at 15:13