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.