After upgrading to chromedriver 74 noticed odd extensions behaviour on Windows.
Is it possible to switch ALL extensions off?
Start chromedriver
chromedriver --log-level=ALL
Create session with extensions DISABLED
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.
TL;DR
Set chromeOptions.useAutomationExtension to false, it will prevent injecting of Chrome Automation Extension
{
"desiredCapabilities": {
"browserName": "chrome",
"goog:chromeOptions": {
"useAutomationExtension": false,
"args": [
"--disable-extensions"
]
}
}
}
Long version
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);
Related
when I use wdio for e2e tests, I got an exception.But my chromedriver is 106.0.1.
[0-1] 2022-10-24T10:58:18.928Z ERROR webdriver: Request failed with status 500 due to session not created: session not created: This version of ChromeDriver only supports Chrome version 104
[0-1] Current browser version is 106.0.5249.119 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
but when I check chromedriver:
chromedriver -v
ChromeDriver 106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249#{#569})
I has been tried all those methods:
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81.
But I still got same exception.please help me.
My configureation:
module.exports.config = {
runner: "local",
path: "/wd/hub",
specs: ["./test/specs/*.js"],
maxInstances: 1,
capabilities: [
{
pageLoadStrategy: "none",
maxInstances: 1,
//
browserName: "chrome",
"goog:chromeOptions": {
excludeSwitches: ["enable-automation"],
},
},
],
logLevel: "warn",
bail: 0,
baseUrl: "http://localhost:3333",
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
services: ["chromedriver"],
framework: "mocha",
reporters: ["spec"],
}
I resolve this question by configure path.
services: [
[
"chromedriver",
{
chromedriverCustomPath: "/usr/local/bin/chromedriver",
},
],
],
I solved this problem by configuring the path. But I don't think this is a good method, because it means that any participant who uses this testing function needs to set the chromedriver in this path.
In fact, another project with the same npm version and my other configuration can run normally without configuring the path. This is really strange! This shows that my local chromedriver has no problems and can run directly.
i am trying to run the chrome beta version with selenium Web-driver.
When i run the test case i got the following error on console see image please:
I have added following lines in the node config file:
{
"capabilities": [
{
"platform": "WINDOWS",
"browserName": "chrome",
"webdriver.chrome.driver":"drive:\selenium\chromedriver.exe",
"chromeOptions": "drive:\Program Files (x86)\Google\Chrome Beta\Application\chrome.exe",
}
]
I am using following setup:
Selenium=2.53
chrome Web-driver= 80_0_3987_16
Google chrome= 80.0.3987.66 (Official Build) beta (64-bit)
we have Hub and Node setup and automated test suit executed from GO cicd Server.
any help would be appreciated, thanks
To run either of the google-chrome browser variant among:
Chrome Canary
Chrome from Dev Channel
Raw build of Chromium for Windows x64
You need to to download the latest Chromium binary from either of the official repositories:
The Chromium Projects
chromium.appspot
Chrome Canary - Nightly build for developers
and you can use the following solution:
Code Block:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class A_Chrome_Canary {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.setBinary("C:\\Users\\AtechM_03\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://www.google.com/");
System.out.println(driver.getTitle());
}
}
Console Output:
Google
Browser Snapshot:
This worked for me
chrome_options.binary_location = "C:/Program Files/Google/Chrome Beta/Application/chrome.exe"
I just rebuilt our development environment. This forced the latest version of chrome and suddenly the protractor based tests stopped working. After some research, I tracked this down to the fact that our chrome options in the protractor configuration file are now ignored.
Here is the configuration that used to work fine before:
exports.config = {
...
multiCapabilities : [
{
browserName: "chrome",
chromeOptions: {
args: [
"--disable-gpu",
"--headless",
'--no-sandbox',
"--incognito"
]
}
},
},
],
...
};
Before After
protractor 6.0.0 6.0.0
selenium 4.0.0-alpha-1 4.0.0-alpha-1
chrome 74.0.3729.157 76.0.3809.100
chromedriver 74.0.3729.6 76.0.3809.68
In recent versions of selenium you have to specify the chrome options as goog:chromeOptions. So just change the chromeOptions line above to the following:
...
"goog:chromeOptions": {
...
and you are back in business.
"chromeOptions": {}
its still usable in most cases, but does not support new arguments provided by chrome
suggested to use
"goog:chromeOptions": {}
Ref to doc: http://chromedriver.chromium.org/capabilities
Same rule for firefox
"moz:firefoxOptions": {}
Ref to doc: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions
I am trying to run a simple selenium case on Ubuntu 16.4 to check my updated ChromeDriver version. Here is my settings information:
OS: Ubuntu 16.04
Chromium: 69.0.3497.81, Built on Ubuntu ,
Chromedriver: v2.8.240825
jdk: openjdk version "1.8.0_181"
And here is my simple java code:
public static void main(String[] args) throws IOException, InterruptedException {
System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log");
System.setProperty("webdriver.chrome.verboseLogging", "true");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless", "window-size=1024,768", "--no-sandbox");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get("https://google.com");
System.out.println("Title is " + driver.getTitle());
if (driver.getPageSource().contains("I'm Feeling Lucky")) {
System.out.println("Pass");
} else {
System.out.println("Fail");
}
driver.quit();
}
But during the runtime, I'm keep getting "Chrome failed to start: exited abnormally", with such in the log file:
"
....
[0.317][INFO]: Launching chrome: /usr/bin/chromium-browser --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-hang-monitor --disable-prompt-on-repost --dis
able-web-resources --enable-logging --full-memory-crash-report --ignore-certificate-errors --load-extension=/tmp/.org.chromium.Chromium.GO6lAd/internal --logging-level=1 --metrics-recording-only --no-first-run --password-store=basic --re
mote-debugging-port=12811 --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --use-mock-keychain --user-data-dir=/tmp/.org.chromium.Chromium.uTbJHO data:,
[0.317][DEBUG]: DevTools request: http://127.0.0.1:12811/json/version
[0.319][WARNING]: PAC support disabled because there is no system implementation
[0.390][DEBUG]: DevTools request failed
[0.440][DEBUG]: DevTools request: http://127.0.0.1:12811/json/version
[0.441][DEBUG]: DevTools request failed
"
But if I was to downgradethe the ChromeDriver to version 2.4, same code runs perfectly. Does anyone know why ? The reason why I need the latest one, is because there is some other feature I need to use.
The failure was actually with older Chrome-driver, of version 2.9, 2.8. etc. The very latest ones, 2.38, or 2.42 does not have such behavior.
I'm using Selenium server 3.8.1, with the hub and 2 nodes.
The hub and each node are executed on different machines.
Currently, I can launch the tests and they're working fine. But, I'm not able to make the headless mode run.
My config JSON only contains the capabilities object.
{
"capabilities":
[{
"browserName": "chrome",
"maxInstances": 3,
"seleniumProtocol": "WebDriver",
"chromeOptions": {
"args": [
"--headless",
"--disable-gpu",
"--window-size=1920x1080"]
}}]
}
I launch the selenium nodes using a .bat that contains the following command:
"C:\Program Files\Java\jre1.8.0_181\bin\java" -jar C:\jobs\selenium-node\selenium-server-standalone-3.8.1.jar -role node -hub http://172.16.0.5:5555/grid/register -port 5558 -nodeConfig config.json -maxSession 3
The selenium node works fine and appears on the selenium grid UI. Also, the capabilities of the chrome driver include the --headless and other parameters:
....
capabilities: Capabilities {browserName: chrome, chromeOptions: {args: [--headless, --disable-gpu, --window-size=1920x1080]}, maxInstances: 3, platform: XP, se:CONFIG_UUID: cdc21610-4c47-4d23-9478-a20..., seleniumProtocol: WebDriver}
....
On the protractor.conf file I have these capabilities, that work when I run the tests locally.
seleniumAddress:'http://172.16.0.5:5555/wd/hub',
getPageTimeout: 120000,
allScriptsTimeout: 120000,
ignoreUncaughtExceptions: true,
chromeOnly:true,
directConnect: false,
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
"javascriptEnabled": true,
"acceptSslCerts": true,
"browserName": "chrome",
"chromeOptions": {
"args": [ "--headless", "--disable-gpu", "--window-size=1920,1080"]
}
},
But, when I launch the tests, the chrome driver isn't executed on headless mode. Works fine, but the different windows keep appearing.
Environment details:
chromedriver version: 2.36.540470
chrome version: 69.0.3497.100
As per your question/comment update you are using:
chromedriverVersion: '2.36.540470, chrome version' => '69.0.3497.100'
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.36
Release Notes of chromedriver=2.36 clearly mentions the following :
Supports Chrome v63-65
You are using chrome=69.0
Release Notes of ChromeDriver v2.42 clearly mentions the following :
Supports Chrome v68-70
So there is a clear mismatch between the ChromeDriver v2.36 and the Chrome Browser v69.0
Solution
Upgrade Selenium to current levels Version 3.14.0.
Upgrade ChromeDriver to current ChromeDriver v2.42 level.
Keep Chrome version between Chrome v68-70 levels. (as per ChromeDriver v2.42 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.