Search code examples
google-chrometestingseleniumautomated-testsappium

Appium - running browser tests without clearing browser data


I'm testing a web application on Chrome, Android (real device, not emulator) using Appium. Whenever I launch a test, all browser data (bookmarks, history etc.) is deleted. Is there any way to stop this from happening?

I tried setting the noReset capability to true, but that didn't help.

Thank you in advance for any help

public static Uri testServerAddress = new Uri("http://127.0.01:4723/wd/hub"); // Appium is running locally
    public static TimeSpan INIT_TIMEOUT_SEC = TimeSpan.FromSeconds(180);

public void SetUpTest()
    {
        if (driver == null)
        {
            DesiredCapabilities testCapabilities = new DesiredCapabilities();
            testCapabilities.SetCapability("browserName", "Chrome");
            testCapabilities.SetCapability("platformName", "Android");
            testCapabilities.SetCapability("deviceName", "S(Galaxy S5)");
            testCapabilities.SetCapability("noReset", true);

            AppUrl = "http://www.google.com/"; //for example
            driver = new RemoteWebDriver(testServerAddress, testCapabilities, INIT_TIMEOUT_SEC);                
            driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, globalTimeoutInSec));
            driver.Navigate().GoToUrl(AppUrl);
        }
    }

Solution

  • Chromedriver always starts totally fresh, nothing is keeping. There is option to re-use the existent one (using desired capability androidUseRunningApp) but unfortunately Appium any way will kill it.

    Please see more details in this post