Reputation: 757
After upgrading to chromedriver 74 noticed odd extensions behaviour on Windows. Is it possible to switch ALL extensions off?
chromedriver --log-level=ALL
curl -d '{"desiredCapabilities":{"browserName":"chrome","goog:chromeOptions":{"args":["--disable-extensions"]}}}' http://localhost:9515/session
Some dev tool extension is loaded
[1558606783.990][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-extensions-except="C:\Users\user\AppData\Local\Temp\scoped_dir19964_411\internal" --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --log-level=0 --no-first-run --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\user\AppData\Local\Temp\scoped_dir19964_22650" data:,
Note
--disable-extensions-except="C:\Users\user\AppData\Local\Temp\scoped_dir19964_411\internal"
Is there a way to get rid of it? Did not find any clues in chromedriver docs, those are extremely sketchy.
Upvotes: 2
Views: 3952
Reputation: 757
Set chromeOptions.useAutomationExtension
to false, it will prevent injecting of Chrome Automation Extension
{
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"useAutomationExtension": false,
"args": [
"--disable-extensions"
]
}
}
}
Automation Extension flag is not mentioned in chromedriver
docs http://chromedriver.chromium.org/capabilities, but can be traced in source code for current version (75.0.)
parser_map["useAutomationExtension"] =
base::Bind(&ParseBoolean, &capabilities->use_automation_extension);
status = internal::ProcessExtensions(
capabilities.extensions, extension_dir->GetPath(),
capabilities.use_automation_extension, &switches, extension_bg_pages);
if (include_automation_extension) {
...
if (switches->HasSwitch("disable-extensions")) {
UpdateExtensionSwitch(switches, "disable-extensions-except",
automation_extension.value());
As mentioned in 54594305 Java code using selenium driver would be
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
Upvotes: 1