Skip to content Skip to sidebar Skip to footer

How To Load Only Html From Web Pages In Selenium

How to load only html from web pages in selenium? I need only html of requested page without css and javascript.

Solution 1:

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:

Post a Comment for "How To Load Only Html From Web Pages In Selenium"