Skip to content

How to switch to proxy using selenium wire #3048

@Damji7

Description

@Damji7

hello,
How to switch to proxy using selenium wire to performe some actions and then it rotats back to the same ip, by the way my script is using the uc mode in simple sb form.

i want to execute proxy in the same browser session to perform some actions when certain text is visible in the webpage, and the it rotats back to the original ip. is it prossible if so can you help with it.

here is my code snippet:

with SB(uc=True, incognito=True, locale_code='en', wire=True) as sb:
def open_the_webpage(sb):
url = "web page"
sb.uc_open_with_reconnect(url, 2)

while sb.is_text_visible('welcome', 'h1'):
    try:
        sb.uc_gui_click_captcha()
    except Exception as e:
        print(f"Error handling captcha: {e}")

    sb.sleep(5)

    if not sb.is_text_visible('welcome', 'h1'):
        print("Captcha successfully passed.")
        break

    print("Captcha not yet passed, retrying...")

if sb.is_text_visible("You are being rate limited", "h2"):
    switch_proxy(sb) #so i can call it here 

def switch_proxy(sb):
#how to use seleniumwire here

thanks and regards <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeduplicateThe answer/solution already exists somewherequestionSomeone is looking for answers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions