Definir chrome.prefs com ligação de python para selênio no chromedriver
Eu tenho procurado todos os dias por isso e parece que não há nenhuma solução atualmente disponível a partir da implementação do chromedriver para python.
Como você define chrome.prefs específicos (por exemplo, configurações de perfil, como profile.managed_default_content_settings.images = 2) usando o método webdriver.Chrome ()?
Eu já tentei através do webdriver.ChromeOptions () sem sucesso. Em Java, existem funções apropriadas disponíveis para isso.
Mas Python? Isto é o que estou fazendo atualmente ...
options = webdriver.ChromeOptions()
options.add_argument('--allow-running-insecure-content')
options.add_argument('--disable-web-security')
options.add_argument('--disk-cache-dir=/var/www/cake2.2.4/app/tmp/cache/selenium-chrome-cache')
options.add_argument('--no-referrers')
options.add_argument('--window-size=1003,719')
options.add_argument('--proxy-server=localhost:8118')
options.add_argument("'chrome.prefs': {'profile.managed_default_content_settings.images': 2}")
self.selenium = webdriver.Chrome(executable_path='/usr/local/bin/chromedriver',chrome_options=options)