我正在试图检索谷歌play商店上发布的与评论员相关的信息。我试图提取评论员的姓名和评论员给出的评分。代码返回第一组信息,然后返回错误。我试着调试,但无法修复。这是我的密码:
driver = webdriver.Chrome(driverLocation)
driver.get('https://play.google.com/store/apps/details?id=com.getsomeheadspace.android&showAllReviews=true')
driver.implicitly_wait(20)
parentElement = driver.find_element_by_xpath('//h3[contains(text(),"User reviews")]//parent::div/div[1]/div')
for child in parentElement.find_element_by_tag_name('div'):
name = child.find_element_by_class_name('X43Kjb').text
indvd_rating = child.find_element_by_xpath('//span[@class="nt2C1d"]//div[@aria-label]').get_attribute('aria-label')
print(name)
print(indvd_rating)
driver.quit()
错误是:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".X43Kjb"}
有人能指出我在哪里犯的错误吗
目前没有回答
相关问题 更多 >
编程相关推荐