我正在尝试抓取新闻评论。我想从此蓝线HTML代码中检索文本“ 72”]
所以,这是我的代码
per_male = driver.find_element_by_css_selector('div.u_cbox_chart_progress u_cbox_chart_male > span.u_cbox_chart_per') print('per_male : ' + per_male.get_attribute('text'))
但是我有这个错误
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"div.u_cbox_chart_progress u_cbox_chart_male > span.u_cbox_chart_per"} (Session info: chrome=83.0.4103.97)
我也使用此代码
per_male = driver.find_element_by_css_selector('div.u_cbox_chart_progress u_cbox_chart_male > span.u_cbox_chart_per') print('per_male : ' + per_male.text)
但是我有同样的错误,如何解决这个问题?
Thx。
我正在尝试抓取新闻评论。我想从蓝线的HTML代码中检索文本“ 72”,所以这是我的代码per_male = driver.find_element_by_css_selector('div.u_cbox_chart_progress ...
要抓取文本72