Appium chrome doesn't keep userdata even the value of 'noReset' is true


#1
import subprocess
from appium import webdriver

subprocess.Popen(args=[r"C:\Users\myComName\AppData\Roaming\npm\appium.cmd", "-p", str(4723), "--udid", serial, "--dont-stop-app-on-reset", "--session-override", "--no-reset"])

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = platform_version
desired_caps['deviceName'] = device_name
desired_caps['browserName'] = 'Chrome'
desired_caps['udid'] = udid
desired_caps['noReset'] = True
desired_caps['fullReset'] = False
desired_caps['dontStopAppOnReset'] = True
desired_caps['enablePerformanceLogging'] = True
desired_caps['newCommandTimeout'] = 1000
desired_caps['chromeOptions'] = {
            'args': ['--user-data-dir="/data/user/0/com.android.chrome/app_chrome/blabla"', 
                     '--user-agent="something"')]
            }

driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

*windows 7
*AVD google API 27(adb root, adb chmod 777 /data, platform version is android 8.1)
*Appium v1.8.1
*python v3.6
*chromedriver v2.34
*android chrome v.61.xx

I want my chrome automation program run with userdata saved and kept. The chrome options of user data gets set correct as the following profile path and the chrome runs well with the following user data path.

/data/user/0/com.android.chrome/app_chrome/blabla/Default

But when I quit the appium driver and then I restart it, all the user data has gone. No cookies, no local storages and so on. Appium’s desired capabilities such as ‘noRest’, ‘fullReset’, and ‘dontStopAppOnReset’ is set correct. Until I restart chrome by appium driver, they are alive even after I terminate appium but when I restart chrome by appium driver, they are cleared.

This problem of clearing user data(it occurred even when I did not change user data path with default path) is not caused by appium? Is It caused by something else such as android, chromedriver, or path, not by appium?

Please help me! Please give me an advice.


#2

Hi! Did you solve your problem? I faced with same thing… Which OS do you use? I noticed that Windows version of ChromeDriver does not accept user-data-dir argument.
When I run chromedriver --help from console it shows:

[OPTIONS]

Options
–port=PORT port to listen on
–adb-port=PORT adb server port
–log-path=FILE write server log to file instead of stderr, increases log level to INFO
–log-level=LEVEL set log level: ALL, DEBUG, INFO, WARNING, SEVERE, OFF
–verbose log verbosely (equivalent to --log-level=ALL)
–silent log nothing (equivalent to --log-level=OFF)
–append-log append log file instead of rewriting
–replayable (experimental) log verbosely and don’t truncate long strings so that the log can be replayed.
–version print the version number and exit
–url-base base URL path prefix for commands, e.g. wd/url
–whitelisted-ips comma-separated whitelist of remote IP addresses which are allowed to connect to ChromeDriver
–minimum-chrome-version minimum supported Chrome version

That means no other arguments are accepted. I guess windows version of chromedriver simply ignores this option and that why there is no way to make chrome keep user profile data(