zoukankan      html  css  js  c++  java
  • 模块四 App控件定位

    2222

     

     路径:C:Usershanjj20688AppDataLocalAndroidandroid-sdk ools

     

    import pytest
    from appium import webdriver
    from time import sleep
    
    class TestDw():
        def setup(self):
            desire_cap = {}
            desire_cap['platformName'] = 'android'
            desire_cap['devicesName'] = '127.0.0.1:7555'
            desire_cap['appPackage'] = 'com.xueqiu.android'
            desire_cap['appActivity'] = 'view.WelcomeActivityAlias'
            desire_cap['dontStopAppOnReset'] = 'true'
            desire_cap['unicodeKeyBoard'] = 'true'
            desire_cap['resetKeyBoard'] = 'true'
    
            self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub",desire_cap)
            self.driver.implicitly_wait(10)
    
        def teardown(self):
            self.driver.quit()
    
        def test_search(self):
            print("搜索用例")
            """
            1.打开雪球app
            2.点击搜索输入框
            3.想搜索输入框里面输入“阿里巴巴”
            4.在搜索输入框里面选择“阿里巴巴”,然后进行点击
            5.获取这只相关阿里巴巴的股价,并判断这只股价的价格>200元
            """
            self.driver.find_element_by_id("com.xueqiu.android:id/tv_search").click()
            e16 = self.driver.find_element_by_id("com.xueqiu.android:id/search_input_text").send_keys("阿里巴巴")
            self.driver.find_element_by_xpath("//*[@resource-id='com.xueqiu.android:id/name' and @text='阿里巴巴']").click()
            cureent_price = float(self.driver.find_element_by_id("com.xueqiu.android:id/current_price").text)
            assert  cureent_price > 200
            sleep(3)
            self.driver.back()
    
    
    if __name__ == '__main__':
        pytest.main()
  • 相关阅读:
    tar.xz文件如何解压
    warnings and errors when executing : make -j4
    ubuntu关机
    Linux系统kernel编译替换升级
    安装linux内核
    二叉树的度数和节点数的关系
    刷题--将搜索二叉树转换成双向链表
    刷题--二叉搜索树与双向链表
    刷题--删除链表中重复的节点
    四舍五入输出
  • 原文地址:https://www.cnblogs.com/hantongxue/p/14401834.html
Copyright © 2011-2022 走看看