A
A
a2NaF2019-01-03 12:18:25
Google Chrome
a2NaF, 2019-01-03 12:18:25

Selenium works with Chrome webdriver with content settings replacement?

In the content settings in Chrome, you can enable or disable, for example, the use of JS. I need to run webdriver with certain values. I tried to connect my pre-created profile, but to no avail. /Default is added to my path and the default profile is opened (even if there is a Default folder with a profile). In the ChromeOptions setting, I also did not find the right one. What to do? I need Chrome

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2019-01-04
@a2NaF

in Python
- disable JS
- disable pictures

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
prefs = {"profile.managed_default_content_settings.images": 2,\
            'profile.managed_default_content_settings.javascript': 2}
chrome_options.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("https://toster.ru/q/592318")

P
PaksinME, 2019-01-03
@PaksinME

ChromeOptions option = new ChromeOptions();
option.addArguments("--disable-javascript");
WebDriver driver = new ChromeDriver(option);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question