6

How to load only html from web pages in selenium?

I need only html of requested page without css and javascript.

micgeronimo
  • 2,069
  • 5
  • 23
  • 44

1 Answers1

4

If you need selenium for web-scraping, strictly speaking, you would still need need javascript and css files since they can take a significant part in the page load and rendering. For example, several parts of a page can be loaded with additional ajax calls, or inserted via a custom javascript logic.

Also, if you want only HTML part of a page, why do you need to involve a real browser?

If you still want to prevent js and css files from loading, you can configure certain permissions in Firefox through tweaking FirefoxProfile preferences, see:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195