0

I was trying to use Selenium with a Tor instance but I got caught in the Cloudflare page. So I wanted to change the IP address until it doesn't require Cloudflare check. I used the function below to renew the Tor instance but it didn't work. I imported Stem and other utilities.

from stem import Signal
from stem.control import Controller
def renew_connection():
       with Controller.from_port(port = 9050) as controller:
       controller.authenticate(password="My authentication code")
       controller.signal(Signal.NEWNYM) 

Here you can see my preferences

profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()

When I use the renew_connection() function it gives a connection error. So what do you suggest to renew the IP address.

mkde
  • 17
  • 1
  • 6
  • Pretty sure the Cloudflare page is going to show up if you have a good IP as well, since it detects selenium. – jluims Mar 18 '22 at 12:02
  • Well, I normally have to change headers but as they say Selenium doesn't have a such feature. What do you suggest in that situation? – mkde Mar 18 '22 at 12:39
  • Try to use [selenium stealth](https://github.com/diprajpatra/selenium-stealth) – Obaskly Mar 18 '22 at 14:39

0 Answers0