【发布时间】:2019-09-13 08:37:19
【问题描述】:
我正在使用以下代码单击“显示更多评论”按钮,但无法正常工作。
代码:
link= 'https://www.capterra.com/p/5938/Oracle-Database/'
driver.get(link)
while True:
try:
driver.find_element_by_partial_link_text('Show more reviews').click()
# Wait till the container of the recipes gets loaded
# after load more is clicked.
time.sleep(5)
except (NoSuchElementException, WebDriverException) as e:
break
page_source = driver.page_source
#BEAUTIFUL SOUP OPTION
soup = BeautifulSoup(page_source,"lxml")
错误说明
NoSuchElementException: no such element: Unable to locate element: {"method":"partial link text","selector":"Show more reviews"}
(Session info: headless chrome=76.0.3809.132)
提前致谢。
【问题讨论】:
-
为什么为真??
标签: python web-scraping nlp selenium-chromedriver