Description
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