5

How to load only html from web pages in selenium?

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

micgeronimo
  • 1,899
  • 5
  • 20
  • 40

1 Answers1

3

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
  • 441,113
  • 110
  • 1,021
  • 1,148