Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
appium测试完成后android 5 gui崩溃_Android_Python_Appium - Fatal编程技术网

appium测试完成后android 5 gui崩溃

appium测试完成后android 5 gui崩溃,android,python,appium,Android,Python,Appium,所以,问题是当appium python测试完成时,android操作系统崩溃了。 看起来任何应用程序都无法打开,然而,设备在屏幕之间滑动时会产生某种反应。 为了解决这个问题,我必须重新启动设备,一切都会恢复正常。 有趣的是,大约60%的病例会发生这种情况 我的测试结构是这样的 PATH = lambda p: os.path.abspath( os.path.join(os.path.dirname(__file__), p) ) class SimpleAndroidTests(u

所以,问题是当appium python测试完成时,android操作系统崩溃了。 看起来任何应用程序都无法打开,然而,设备在屏幕之间滑动时会产生某种反应。 为了解决这个问题,我必须重新启动设备,一切都会恢复正常。 有趣的是,大约60%的病例会发生这种情况

我的测试结构是这样的

PATH = lambda p: os.path.abspath(
    os.path.join(os.path.dirname(__file__), p)
)

class SimpleAndroidTests(unittest.TestCase):
    desired_caps = {}
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '5.1'
    desired_caps['deviceName'] = 'here_device_id 
    desired_caps['app'] = PATH(
        'path_to_apk'
    )
    def setUp(self):
        desired_caps = Main.desired_caps
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    def tearDown(self):
        self.driver.quit()
    def test_add_contacts(self):
        el = self.driver.find_element_by_accessibility_id("Add Contact")
        el.click()
        textfields = self.driver.find_elements_by_class_name("android.widget.EditText")
        textfields[0].send_keys("Appium User")
        textfields[2].send_keys("someone@appium.io")
        self.assertEqual('Appium User', textfields[0].text)
        self.assertEqual('someone@appium.io', textfields[2].text)
        self.driver.find_element_by_accessibility_id("Save").click()s
        alert = self.driver.switch_to_alert(
        self.driver.find_element_by_android_uiautomator('new UiSelector().clickable(true)').click()
        self.driver.press_keycode(3)
if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(SimpleAndroidTests)
    unittest.TextTestRunner(verbosity=2).run(suite)

这个问题只在android 5,5+设备中重现。在adroid 4.4上一切正常。

这个问题在Android 5.1中得到了修复