答案 0 :(得分:1)
您要查找的内容位于不同的iframe
上,您需要另外切换框架
.....
time.sleep(5)
# go to parent or top frame
driver.switch_to.default_content()
iframe = driver.find_element_by_css_selector('iframe[title="recaptcha challenge"]')
driver.switch_to.frame(iframe)
#title = driver.find_element_by_css_selector('.rc-imageselect-desc-wrapper strong') # cars
title = driver.find_element_by_class_name('rc-imageselect-desc-wrapper') # Select all images with cars.....
print(title.text)
# with BeautifulSoup
#html = driver.page_source()
#soup = BeautifulSoup(html, 'html.parser')
#title = soup.find('div',{'class':'rc-imageselect-desc-wrapper'})
#print (title)