Skip to content

UC + CDP - Timezone config reset after element not found? #3765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alerodm opened this issue May 22, 2025 · 2 comments · Fixed by #3766
Closed

UC + CDP - Timezone config reset after element not found? #3765

alerodm opened this issue May 22, 2025 · 2 comments · Fixed by #3766
Assignees
Labels
bug Uh oh... Something needs to be fixed UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@alerodm
Copy link

alerodm commented May 22, 2025

Hey! So I have the python snippet below which I was using to test the timezone override.

with SB(uc=True, test=False, locale_code="en-US") as sb:
    sb.activate_cdp_mode("https://ipwhois.io/", timezone="America/Chicago")
    print(sb.cdp.evaluate("return Intl.DateTimeFormat().resolvedOptions().timeZone;"))
    try:
        print(sb.cdp.find_element("div[class='foo']").text)  # non-existent element
    except Exception:
        pass
    print(sb.cdp.evaluate("return Intl.DateTimeFormat().resolvedOptions().timeZone;"))

When the element is found I have no issues:

America/Chicago
IP Geolocation API
America/Chicago

However, when the element isn't found the timezone override seems to have been reset?

> uv run sb_timezone.py
America/Chicago
America/Buenos_Aires

Currently on seleniumbase==4.38.2 and Chrome 136.

Am I missing any steps? Thanks

@mdmintz mdmintz added bug Uh oh... Something needs to be fixed UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode labels May 22, 2025
@mdmintz mdmintz self-assigned this May 22, 2025
@mdmintz
Copy link
Member

mdmintz commented May 22, 2025

Good catch. That's a bug.
Likely has gone uncaught until now because normally it raises an error when not in a try/except block, but that exception was caught in your case and the program continued.

@mdmintz
Copy link
Member

mdmintz commented May 22, 2025

This was resolved in 4.38.3 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.38.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh oh... Something needs to be fixed UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants