Masha
Masha

Reputation: 857

Symfony domCrawler parse html not shown in page source

I believe the question has already been discussed but I could not find the answer. The question is how to get html contents of the page which is not shown when I right-click and select page source in my browser? Also in chrome developer tools when I right click on an element and choose inspect element I can see it in the DOM tree. Example page is (trying to get the list of sites):

http://www.liveinternet.ru/rating/

For getting html contents I use Symfony2 DomCrawler and it gets html perfectly except the cases when it is not present on page source. Thank you.

Thank you

Upvotes: 0

Views: 949

Answers (1)

Pieter van den Ham
Pieter van den Ham

Reputation: 4484

This is because that content is loaded dynamically using JavaScript. Since the DomCrawler does not execute <script> tags, you are unable to crawl any HTML that is not already present on the DOM the moment you load the page. As an alternative, try Selenium, which does execute JavaScript.

Upvotes: 3

Related Questions