The following code disables stylesheets and images on a page loaded with Selenium Firefox webdriver:
from selenium import webdriver
firefox_profile = webdriver.
run the following javascript through the selenium script executor
var queries = ['link[rel=stylesheet][href]', 'style'];
for (var i = 0; i < queries.length; i++) {
var remove = document.querySelectorAll(queries[i]);
for (var j = 0; j < remove.length; j++) {
remove[j].outerHTML = '';
}
}
var inline = document.querySelectorAll('*[style]');
for (var i = 0; i < inline.length; i++) {
inline[i].removeAttribute('style');
}
I have tested this with google, it works. got the above script from this firefox extension code
driver = webdriver.Firefox(firefox_profile)
driver.get('http://www.google.com/')
driver.execute_script("")