Saved Chrome settings not being kept when testing with Appium

Let’s say I want to save settings in my Chrome in Android.

Turn off suggested translations
Don’t block pop ups
Never ask for remembering the password

because in my tests all of those dialogs appear and break them.

I go to Chrome > Settings and I do all those changes. And while Im there they stay. As soon as I put appium to work in that device, all those changes are resetted to the default and all those dialogs appear again.

I used to have a similar issue with Chrome on Desktop + Selenium. When Chrome started there, the bookmarks, extensions, preferences, were gone, as soon as I go back to use the browser manually, everything was OK. The problem was that Selenium creates a new fresh profile every time. If otherwise wasn’t specified. So I found that you can tell selenium to use default profile (same as manual user) and you would be able to have the same config for Chrome.

However now, I set those settings, then tests run, none of my changes are applied but when I go back they are not there even for “my profile” is there a way to keep them? is this an appium issue? is this a browser issue? can I set them on appium previous to tests running? I just need to make this changes and I need them to stay

EDIT:

This is on a Lollipop Nexus 5 with Chrome 40.0.2214.109
Appium 1.3.6
Mac OSX 10.10.2

I don’t know what else could be relevant

Anybody knows what’s happening?

Well a way to auto dismiss the block pop-ups dialog?
or save the preference to don’t block and keep it?

I was looking for capabilities like autoAcceptAlerts autoDismissAlerts safariAllowPopups but for Chrome + Android? or a command with that functionality

Basically I need to dismiss or avoid pop-up blocker on Chrome + Android

I tried by saving Chrome settings to allow pop-ups and then run the tests. It seemed to me that Chrome starts a totally fresh session so it doesn’t keep the settings.

Per Chomedriver documentation located here Sign in - Google Accounts

Android-specific Desired Capabilities

The following capabilities are applicable to both Chrome and WebView apps:
androidPackage: The package name of the Chrome or WebView app.
androidDeviceSerial: (Optional) The device serial number on which to launch the app (See Multiple Devices section below).
androidUseRunningApp: (Optional) Attach to an already-running app instead of launching the app with a clear data directory.

I was right.

I don’t see a way to dismiss this dialogs on Appium documentation so I proceeded to use that capability by doing:

  caps = {
    platformName:  'Android',
    platformVersion: '4.4.4',
    deviceName:    'mydevicenamehere',
    udid:    'mydeviceIdhere',
    browserName:    'Chrome',
    chromeOptions: {
    androidUseRunningApp: true
    }

It fail first, giving me a “Chrome not reachable” error. It was because the app was not actually opened. Ran again, this time I manually opened first. When running, Appium closed the app via

info: [debug] Killing any old chromedrivers, running: ps -ef | grep /usr/local/lib/node_modules/appium/build/chromedriver/mac/chromedriver | grep -v grep |grep -e '--port=9515\(\s.*\)\?$' | awk '{ print $2 }' | xargs kill -15

And because this capability, it didn’t opened again. So tried again, opened it manually, Appium closed it, I opened manually, and the test ran succesfully, it didn’t show the pop-up blocker dialog as I wanted. Now the problem is how do I avoid to have to start manually the browser after appium kills all chrome drivers?

Found the solution.

  caps = {
    platformName:  'Android',
    platformVersion: '4.4.4',
    deviceName:    'mydevicename',
    udid:    'mydeviceudid',
    browserName:    'Chrome',
    chromeOptions: {
    args: ['disable-popup-blocking']
    }
  }

Chrome driver capability work as intended

Learned:
Chromedriver always starts totally fresh, it doesn’t keep anything, but there’s an option to re-use an existent one. However Appium always kills it so it has to be restarted but because this option it doesn’t restart by itself, so that’s not the best option.

There’s a bunch of specific capabilities specific to chrome that can be used.

1 Like

Hi @garyst1981

I am getting Error when i declared the below statement

Please find the code below to launch the browser in the device,
DesiredCapabilities dc = new DesiredCapabilities();
dc = {
platformName: ‘Android’,
platformVersion: ‘4.4.4’,
deviceName: ‘mydevicename’,
udid: ‘mydeviceudid’,
browserName: ‘Chrome’,
chromeOptions: { args: [‘disable-popup-blocking’]
}
}
Can you please help us on this ?

Thanks
@Gowthaman_M

What error do you get?

Hi @garyst1981

Is this a JAVA Code,

dc = {
platformName: ‘Android’,
platformVersion: ‘4.4.4’,
deviceName: ‘mydevicename’,
udid: ‘mydeviceudid’,
browserName: ‘Chrome’,
chromeOptions: { args: [‘disable-popup-blocking’]
}

Thanks,
Gowtham

No, that’s a json containing the info of the device you want to run the tests, by the way, you should substitute ‘mydevicename’ and ‘mydeviceudid’ for the actual deviceid of the device you are using

to get the device id you can go to your terminal and do adb devices you should get a big id there like a serial number, that’s the device Id

chromeOptions: { args: [‘disable-popup-blocking’] and disable-save-password-bubble on my chrome capabilities but my application getting "Remember Your PassWord " Pop up , how can i disable that pop on Android Galaxy S4
Thank you
Raj Beemi

I’ve also faced with that problem: Chrome store password pop-up appears

String context = getCurrentContext();
driver.context("NATIVE_APP")
driver.findElementById("Close");
click();
 driver.switchTo().window(context);

try above code that should close the Save PassWord PopUp

Thanks for the solution. It would be great if the message appears at the same tme. But it appears unexpectedly: after 3 sec, 10 sec, 30 sec.

Can you please post the location of json file to be edited ?

wherever you have it, that’s a config that you have to setup somewhere to tell appium to open Chrome, in that device, with that particular set of settings. If you are using cucumber with ruby for example that would go on the env.rb file, if you are doing straight tests, it should be at the beginning of your tests

1 Like

Any update on this issue