How to Get Crawl content in Crawljax

前端 未结 2 1333
半阙折子戏
半阙折子戏 2021-01-16 17:21

I have crawl Dynamic webpage using Crawljax. i can able to get crawl current id, status and dom. but i can\'t get the Website content.. Any one help me??

Cra         


        
2条回答
  •  感动是毒
    2021-01-16 17:33

    To get the website content, use the following function:

    cc.getCurrentState().getDom()
    

    This function does not return a DOM node, but actually returns the page's HTML text instead. This is the right function to use if you want the page content, but it sounds like it returns a DOM node, so the name getDom is a misnomer. To get a DOM node instead, use:

    cc.getCurrentState().getDocument()
    

    which returns the Document DOM node.

    You can retrieve the page content with:

    cc.getCurrentState().getDocument().getTextContent()

    (EDIT: This won't work -- getTextContent always returns null when called on Documents.)

提交回复
热议问题