Appium不保留应用程序设置

时间:2018-03-22 13:39:41

标签: android python-3.x appium appium-android

我正在测试包含文档部分的Android应用。 安装后,它默认包含一个文档,向下滑动它会更新5个文档。这是一个测试案例,然后该应用程序关闭

def tearDown(self):
    self.driver.quit()

在我开始另一个测试后,在此之后,只有一个文档。我究竟做错了什么?如何使用默认设置阻止应用启动?

我使用的是Appium v​​1.7.2和Python

这是一个代码

import os
import unittest
from appium import webdriver
from time import sleep
from appium.webdriver.common.touch_action import TouchAction


class meTest(unittest.TestCase):

    def setUp(self):
            desired_caps = {}
            desired_caps['platformName'] = 'Android'
            desired_caps['platformVersion'] = '7.1.1'
            desired_caps['deviceName'] = 'Xperia Z5 Dual'
            desired_caps['autoGrantPermissions'] = 'true'
            desired_caps['appPackage'] = 'package.name'
            desired_caps['newCommandTimeout'] = '3600'
            desired_caps['appActivity'] = 'com.android....MainActivity'

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

    def test_DocumentsUpdate(self):
        sleep(5)
        manuallyDocumentSelectioBbutton = self.driver.find_element_by_xpath("//*[contains(@text, 'Documents')]").click()
        sleep(5)
        self.driver.swipe(470, 90, 470, 1000, 10000)
        sleep(120)

    def tearDown(self):
        self.driver.quit()

# ---START OF SCRIPT
if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(meTest)
    unittest.TextTestRunner(verbosity=2).run(suite)

1 个答案:

答案 0 :(得分:3)

Appium默认重置每个测试用例的应用程序。包括以下功能,您应该获得您正在寻找的行为。

ROW_NUMBER()

有关各种功能的更多信息,请访问https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md

相关问题