I want to disable CSS and images in Selenium with Chromedriver all done in Python. My current code looks like this:
from selenium import webdriver
chrome_path = r"/Folder/chromedriver"
driver = webdriver.Chrome(chrome_path)
driver.get("https://www.url.com")
All works and it loads the page, but I want to speed it up and only load the Dom tree and javascripts, because I need this to click a button.
Someone else asked this question and got this answer:
chromeOptions = webdriver.ChromeOptions()
prefs = {"profile.managed_default_content_settings.images":2}
chromeOptions.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_options=chromeOptions)
However this doesn't work because I guess it doesn't find the driver. As far as the images go I really don't have an idea to stop loading them.