Skip to content
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

Undetected ChromeDriver cannot locate element by XPath, while standard ChromeDriver works #2100

Open
Bog555 opened this issue Dec 9, 2024 · 0 comments

Comments

@Bog555
Copy link

Bog555 commented Dec 9, 2024

Description:
Hello,

I am experiencing an issue with undetected ChromeDriver when trying to locate an element by XPath. The same code works perfectly with the standard ChromeDriver, but fails with undetected ChromeDriver. Here's the setup and behavior:

Environment:
Undetected ChromeDriver Version: (provide the version, e.g., v3.4.6)
Selenium Version: (e.g., 4.27.1)
Chrome Version: 131.0.6778.86 (64-bit)
Operating System: Windows 11 Pro (64-bit)
from selenium import webdriver
from selenium.webdriver.common.by import By
import undetected_chromedriver as uc

Using undetected_chromedriver

driver = uc.Chrome()
driver.get("https://example.com")

Locating the email field

email_field = driver.find_element(By.XPATH, '//*[@id="user_email"]')
email_field.send_keys('555') # This fails with undetected ChromeDriver

Issue:
The element with XPath //*[@id="user_email"] cannot be located when using undetected ChromeDriver. The script raises a NoSuchElementException.
When using the standard ChromeDriver, the exact same code successfully finds the element and sends keys without issues.

Observations:
Headless mode is disabled.
The element is not inside an iframe.
Explicit waits (e.g., WebDriverWait) did not help resolve the issue.
The element is visible and interactive when using the browser manually.
Question:
Is there a known issue or limitation with undetected ChromeDriver in locating elements by XPath? Are there additional configurations or arguments required to make this work?

Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant