selenium firefox设置禁用图片、css和js
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("permissions.default.image", 2)#某些firefox只需要这个
firefox_profile.set_preference("browser.migration.version", 9001)#部分需要加上这个
禁用css
firefox_profile.set_preference("permissions.default.stylesheet", 2)
禁用flash
firefox_profile.set_preference("dom.ipc.plugins.enabled.libflashplayer.so", "false")
禁用js
firefox_profile.set_preference("javascript.enabled", "false")
driver = webdriver.Firefox(firefox_profile=firefox_profile)
driver.get("https://re.jd.com/")
来源:PY学习网:原文地址:https://www.py.cn/article.html