Home > other >  Hope everybody to help!!!!! Beginning with selenium crawl jingdong goods comments, unable to find a
Hope everybody to help!!!!! Beginning with selenium crawl jingdong goods comments, unable to find a

Time:09-24

The from the selenium import webdriver
Chromepath="F: \ _Python, Anaconda, chromedriver \ chromedriver_win32, chromedriver"
Driver=webdriver. Chrome (chromepath)
Driver. The get (" https://item.jd.com/4161503.html ")
Comment=driver. Find_element_by_css_selector (' div. Reply - content ')
The content=eachcomment. Find_element_by_tag_name (' p ')
Print (the text)

Above is the source code

Error: NoSuchElementException: no to element: Unable to locate element: {" method ":" the CSS selector ", "selector" : "div.com ment - column. J - comment - the column"}
(Session info: chrome=57.0.2987.133)
(Driver info: chromedriver=2.29.461591 ebf098771772160f391d75e589dc567915b233 (62), the platform=Windows NT 6.1.7601 SP1 x86_64)

Check for web

& lt; Div id="comment - 0" data - TAB="item" & gt; . & lt;/div> The label with content


But run driver. When page_source
See & lt; Div id="comment - 0" data - TAB="item" & gt; All comments & lt;/div> \ n

Hope everybody to help

CodePudding user response:

Using selenium? The speed is slow

CodePudding user response:

The content of the comments section the start when loading the page does not display, need you to scroll to the bottom will be loaded, driver. Execute_script (' scrollBy (0100 000) ') can solve to let it get to the bottom loading out the comment,
But the label you are looking for your check again is there,
  • Related