How to load only html from web pages in selenium

How to load only html from web pages in selenium?

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

+3


source to share


1 answer


If you need selenium for web scraping, strictly speaking, you will still need javascript and css files, as these can significantly affect page loading and rendering. For example, multiple parts of the page can be loaded with additional ajax calls, or inserted through custom JavaScript logic.

Also, if you only want the HTML portion of the page, why would you need a real browser?



If you still want to prevent js and css files from being loaded, you can adjust specific permissions in Firefox using settings FirefoxProfile

, see

+2


source







All Articles