Saved Chrome settings not being kept when testing with Appium

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?