appium+python官方sample code(三)

来源:互联网 发布:itc网络广播功放说明书 编辑:程序博客网 时间:2024/06/06 13:18


本系列第三篇


from appium import webdriverfrom appium import SauceTestCase, on_platformsapp = "http://appium.s3.amazonaws.com/NotesList.apk"platforms = [{                "platformName": "Android",                "platformVersion": "4.4",                "deviceName": "Android Emulator",                "appPackage": "com.example.android.notepad",                "appActivity": ".NotesList",                "app": app,                "appiumVersion": "1.3.4"            }]@on_platforms(platforms)class SimpleAndroidSauceTests(SauceTestCase):    def test_create_note(self):        el = self.driver.find_element_by_accessibility_id("New note")        el.click()        el = self.driver.find_element_by_class_name("android.widget.EditText")        el.send_keys("This is a new note!")        el = self.driver.find_element_by_accessibility_id("Save")        el.click()        els = self.driver.find_elements_by_class_name("android.widget.TextView")        self.assertEqual(els[2].text, "This is a new note!")els[2].click()