鍍金池/ 問(wèn)答/Python  HTML/ 初用selenium爬取京東商品評(píng)論,無(wú)法找到想要的數(shù)據(jù)

初用selenium爬取京東商品評(píng)論,無(wú)法找到想要的數(shù)據(jù)

driver = webdriver.Chrome(chromepath)
driver.get("https://item.jd.com/4161503.html")
comment = driver.find_element_by_css_selector('div.reply-content')
content = eachcomment.find_element_by_tag_name('p')
print(content.text)

以上是源碼

報(bào)錯(cuò)是:NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"div.comment-column.J-comment-column"}
(Session info: chrome=57.0.2987.133)
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 6.1.7601 SP1 x86_64)

對(duì)網(wǎng)頁(yè)檢查
圖片描述
<div id="comment-0" data-tab="item">........</div>這對(duì)標(biāo)簽內(nèi)有內(nèi)容

但運(yùn)行driver.page_source時(shí)
看到<div id="comment-0" data-tab="item">全部評(píng)論</div>n

回答
編輯回答
糖果果

把page參數(shù)改改就可以拿全部評(píng)論,代表頁(yè)數(shù)
https://sclub.jd.com/comment/...

2017年10月23日 14:24