Skip to content

element.find_element in CDP vs UC mode #3733

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
breadacker opened this issue May 9, 2025 · 0 comments
Closed

element.find_element in CDP vs UC mode #3733

breadacker opened this issue May 9, 2025 · 0 comments
Labels
duplicate The answer/solution already exists somewhere self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@breadacker
Copy link

with SB(uc=True, headless2=False, test=True, maximize=True, incognito=True, do_not_track=True, ad_block=True) as sb: # Open the main page once sb.driver.uc_open_with_reconnect(url, reconnect_time=10) try: # Get all green cards on the page using the combined class selector cards = sb.find_elements(By.CSS_SELECTOR, ".green") for card in cards: try: # Parse route information from the element route_text = card.find_element(By.CSS_SELECTOR, ".mission").text.strip()

Above code works perfect; however, when i wanted to activate CDP mode, below code gives the following error:

with SB(uc=True, headless2=False, test=True, maximize=True, incognito=True, do_not_track=True, ad_block=True) as sb: # Open the main page once sb.activate_cdp_mode(url) try: # Get all green cards on the page using the combined class selector cards = sb.find_elements(By.CSS_SELECTOR, ".green") for card in cards: try: # Parse route information from the element route_text = card.find_element(By.CSS_SELECTOR, ".mission").text.strip()

route_text = card.find_element(By.CSS_SELECTOR, ".mission").text.strip() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not callable

@mdmintz mdmintz added self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode duplicate The answer/solution already exists somewhere labels May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The answer/solution already exists somewhere self-resolved You closed/solved the issue on your own UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants