Trying to pick up the right combination of chrome options to disable annoying Password Manager popup after passing login form.
Here is how I create a driver:
Feature: Driver initialization
Background:
* configure retry = { count: 5, interval: 3000 }
Scenario Outline: using <config>
* def config = <config>
* set config.showDriverLog = true
* configure driver = config
* driver 'https://google.com'
* maximize()
* retry().waitUntil("document.readyState == 'complete'")
Examples:
| config |
| {type: 'chrome', executable: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', webDriverSession: { desiredCapabilities: { browserName: 'chrome', 'goog:chromeOptions': { credentials_enable_service: false, profile.password_manager_enabled: false }}}} |
Also I tried some other combinations with addOptions: [ ... ] and so on but nothing helps. Any ideas?
I had a similar issue but I found a workaround. Instead of using driver type to be chrome and pointing to the google chrome application installed locally download the chromedriver and use that. I used this on Windows and placed the chromedriver under C:/Windows/ folder. This did not bring up the password manager popup when executing the tests.
I've heard that using incognito mode can solve this.
Related
Protractor creates a brand new Chrome profile every time it runs. So what i want to do it will enable popup for chrome browser every time when protractor test runs.
I don't want to use existing profile.Is there any way to do ?
You can create instance of chrome custom profile and it can be passed to capabilities.
export const chromeProfile = {
browserName : 'chrome',
maxInstances: 1,
chromeOptions: {
args: [
// mention list of all setting for chrome browser
//For example following two lines disable chrome popup
'disable-infobars=true',
'--disable-popup-blocking'
],
prefs: {
// disable password popup
'credentials_enable_service': false
}
}
};
I added in acceptance.suite.yml
chromeOptions:
args: ["--headless", "--disable-gpu","--test-type","--ignore-certificate-errors"],
but no luck? what can i do now
description edit:
When i start tests in headless mode they get stuck, in the _output file (fail.png) i get blank page. So i think that they get to "Insecure Connection" page and can't get through it, and my question is how to avoid that page
I suspect the argument you want is allow-insecure-localhost. This line worked for me to configure my acceptance.suite.yml file in CodeCeption.
- WebDriver:
url: xxx.com
window_size: false # disabled in ChromeDriver
port: 9515
browser: chrome
capabilities:
goog:chromeOptions:
args: ["allow-insecure-localhost","headless","start-maximized"]
This page lists all the options that chrome supports https://peter.sh/experiments/chromium-command-line-switches/#allow-insecure-localhost. Google themselves link to that (3rd party) page from their own page describing ChromeDriver config https://sites.google.com/a/chromium.org/chromedriver/capabilities.
Not sure if this already answered but according to codeception documentation
https://codeception.com/docs/modules/WebDriver
modules:
enabled:
- WebDriver:
config:
url: 'http://localhost/'
browser: chrome
capabilities:
acceptInsecureCerts: true
This works for me,
ChromeOptions options = (ChromeOptions) caps.getCapability(ChromeOptions.CAPABILITY);
options.addArguments("--headless", "--disable-gpu", "--window-size=1366,768", "--no-sandbox");
caps.setAcceptInsecureCerts(true);
Please try following code .
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--no-sandbox");
options.addArguments("--headless", "--window-size=1920,1200", "--ignore-certificate-errors");
options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
driver = new ChromeDriver(options);
It is always suggested to set the firefox profile in DesiredCapabilities and pass that through the wire ,where the hub is running . Like below
DesiredCapabilities caps = DesiredCapabilities.firefox();
FirefoxProfile profile=new FirefoxProfile(new File("Local Path to firefox profile folder"));
caps.setCapability(FirefoxDriver.PROFILE, profile);
URL url = new URL("http://localhost:4444/wd/hub");
WebDriver driver= new RemoteWebDriver(url,caps );
But sending the huge 87-90 mb profile info to hub over http ,for each selenium test case slowing down the test case execution .
I have tried configuring the grid node with "Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"", property in json node config file like below.
{
"configuration":
{
.//Other Settings
.//Other Settings
.//Other Settings
"Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"",
"maxSession":7,
"registerCycle":5000,
"register":true
},
"capabilities":
[
{"browserName":"firefox",
"seleniumProtocol":"WebDriver",
"maxInstances":5,
"platform":"VISTA"
}
]
}
But running with the above configuration is throwing below error .
WebDriverException: Firefox profile 'E:\Firefox_Profile_Location'
named in system property 'webdriver.firefox.profile' not found
Advanced thanks for any help on how to configure the firefox profile from the node side .
You need to provide the profile in the capabilities object as a base64 encoded zip:
var fs = require('fs');
capabilities: [
{
browserName: 'firefox',
seleniumProtocol: 'WebDriver',
maxInstances: 5,
platform: 'VISTA',
firefox_profile: new Buffer(fs.readFileSync("./profile.zip")).toString('base64')
}
]
Moreover Firefox creates the missing files for a given profile. So you should keep just the necessary files in the profile depending on your needs:
Preferences: user.js
Passwords: key3.db
logins.json
Cookies: cookies.sqlite
Certificate: cert8.sqlite
Extensions: extensions/
I think you'll have to use firefox profile name and not the location.
"webdriver.firefox.profile":"default"
Have a look at this and this and this
If you want know how to create a profile follow this and this
I'm currently trying to use Browsermob with WebdriverIO and I found this code on another answer, but when I run it, the firefox browser comes up and I see activity in the console windows I have selenium and browsermob-proxy running, but it does not go to the search.yahoo.com page. It just sits at a blank page and the tests ends (which says it passed, but that's something else)
I'm running the latest WebdriverIO and Browsermob on a Mac
Here's the code
var Proxy = require('browsermob-proxy').Proxy
, webdriverio = require('webdriverio')
, fs = require('fs')
, proxy = new Proxy()
;
proxy.cbHAR('search.yahoo.com', doWebio, function(err, data) {
if (err) {
console.error('ERR: ' + err);
} else {
fs.writeFileSync('stuff.har', data, 'utf8');
}
});
function doWebio(proxy, cb) {
var browser = webdriverio.remote({
host: 'localhost'
, port: 4444
, desiredCapabilities: { browserName: 'firefox', seleniumProtocol: 'WebDriver', proxy: { httpProxy: proxy } }
});
browser
.init()
.url("http://search.yahoo.com")
.setValue("#yschsp", "javascript")
.submitForm("#sf")
.end().then(cb);
}
have you tried using chrome. Maybe it'll work. To do so:
Add chromedriver from here to your /usr/bin
make change to above code like below (note upper case P in proxy)
start selenium server and browserMob as usual and run the test
desiredCapabilities: { browserName: 'chrome', seleniumProtocol: 'WebDriver', Proxy: { httpProxy: proxy } }
For those who come to this, with FireFox, you now need GeckoDriver installed to use FireFox with Selenium. https://github.com/mozilla/geckodriver/releases
Also, the BrowserMob proxy hasn't had a release since 2016. The BrowserUp Proxy is an actively maintained drop-in replacement https://github.com/browserup/browserup-proxy with support up to Java 11, active development, brotli support, security fixes, and more.
Every time my webdriver tests login into the application, 'Do you want chrome to save your password' pop up appears.. Is there a way to avoid this??
Please help.
Thanks,
Mike
You need to configure the following chrome driver options:
chromeOptions: {
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
}
}
}
I'm using Python, and this worked for me:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option('prefs', {
'credentials_enable_service': False,
'profile': {
'password_manager_enabled': False
}
})
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://google.com')
Just add these preferences to your chrome driver options:
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("credentials_enable_service", false);
prefs.put("password_manager_enabled", false);
options.setExperimentalOption("prefs", prefs);
Yeah I just found the answer. I had to look into the Chrome's user data directory and find all the available chromeOptions the Preferences file. I'm on Centos 7 so the path looks like this:
~/.config/google-chrome/Default/Preferences
In order to remove the save password dialog, the config JSON chromeOptions section needs to have this:
chromeOptions: {
prefs: {
profile: {
password_manager_enabled: false
}
}
}
It really makes me happy that I have finally found these options, however, it still is disappointing that google or selenium didn't list all the configurable preferences.
Thanks to #karanvir Kang comment above, I added the following to my conf.js which I use when I call protractor. Example
protractor tests/conf.js --specs /tests/e2e/myspec.spec.js
And in my conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumPort: '4455',
baseUrl: url,
directConnect: false,
//getMultiCapabilities: helper.getFirefoxProfile,
capabilities: {
browserName: 'chrome',
chromeOptions: {
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
}
},
args: [
'--disable-cache',
'--disable-application-cache',
'--disable-offline-load-stale-cache',
'--disk-cache-size=0',
'--v8-cache-options=off'
]
}
},
You can also start the chromedriver in incognito mode to stop the infobars from appearing. Please note that the experience will be like the incognito mode. Command will be
chrome.exe --incognito if you are running from command line
you can add --incognito to chromeswitch array for executing from webdriver.
To provide a more complete picture, here is a working configuration for Watir in a Selenium Grid:
RSpec.configure do |config|
config.before :all do
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
prefs: {
'credentials_enable_service': false,
'profile': {
'password_manager_enabled': false
}
}
}
)
#browser = Watir::Browser.new(
:remote,
url: "http://#{ENV.fetch('HUB_HOST')}/wd/hub",
desired_capabilities: capabilities
)
end
config.after :all do
#browser&.close
end
end
See a full proof of concept on github at docker-grid-watir.
I know this is pretty old, it has been answered correctly and all. Just wanted to give my 5 cents. If you are using Robot Framework, bellow is the way to do it.
open-browser
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
${cred_dict}= Create Dictionary credentials_enable_service=${FALSE}
Call Method ${chrome_options} add_experimental_option prefs ${cred_dict}
Create Webdriver Chrome chrome chrome_options=${chrome_options}