无法启动具有 noReset='true' 功能的应用程序

问题描述 投票:0回答:1

这里是Appium的示例代码,如果我添加

noReset='true'
,那么应用程序不会启动,测试失败。删除它一切正常。

上下文是在某些测试中,我不想清除应用程序缓存。但这个

noReset
好像坏了,请帮忙。

Appium: 2.5.3
Python: 3.12
Appium-Python-Client: 4.0.0
import unittest
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy

capabilities = dict(
    platformName='Android',
    automationName='uiautomator2',
    deviceName='Android',
    appPackage='com.android.settings',
    appActivity='.Settings',
    language='en',
    locale='US',
    noReset='true' # comment this line, the app could be launched
)

appium_server_url = 'http://localhost:4723'

class TestAppium(unittest.TestCase):
    def setUp(self) -> None:
        self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))

    def tearDown(self) -> None:
        if self.driver:
            self.driver.quit()

    def test_find_battery(self) -> None:
        el = self.driver.find_element(by=AppiumBy.XPATH, value='//*[@text="Battery"]')
        el.click()

if __name__ == '__main__':
    unittest.main()
android python-3.x appium
1个回答
0
投票

我认为在自动化操作系统或捆绑应用程序(如设备设置

noReset
)时,您不能使用
fullReset
com.android.settings
选项。这没有问题,因为我们不负责测试操作系统附带的应用程序。在所有其他应用程序中,您应该都会遇到这样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.