Skip to content

element.find_element in CDP vs UC mode #3733

Closed as duplicate of#3554
Closed as duplicate of#3554
@breadacker

Description

@breadacker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModeduplicateThe answer/solution already exists somewhereself-resolvedYou closed/solved the issue on your own

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions