本文介绍了Appium - 在不清除浏览器数据的情况下运行浏览器测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Appium 在 Chrome、Android(真实设备,而不是模拟器)上测试 Web 应用程序.每当我启动测试时,所有浏览器数据(书签、历史记录等)都会被删除.有什么办法可以阻止这种情况发生吗?

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?

我尝试将 noReset 功能设置为 true,但这没有帮助.

I tried setting the noReset capability to true, but that didn't 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);
        }
    }

推荐答案

Chromedriver 总是以全新的方式启动,没有任何保留.可以选择重新使用现有的(使用所需的功能 androidUseRunningApp),但不幸的是 Appium 会以任何方式杀死它.

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.

请在此发布

这篇关于Appium - 在不清除浏览器数据的情况下运行浏览器测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 01:25