测试数据

原始代码

# !/usr/bin/env python
# -*- coding:utf-8 -*-

"""
@File    : demo.py
@Time    : 2020/02/22
"""


from appium import webdriver
import pytest


class TestSearchFunc():
    def setup(self):
        desire_cap = {}
        desire_cap['platformName'] = 'Android'
        desire_cap['platformVersion'] = '5.1.1'
        desire_cap['deviceName'] = 'emulator-5554'
        desire_cap['appPackage'] = 'com.xueqiu.android'
        desire_cap['appActivity'] = 'view.WelcomeActivityAlias'
        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_search01(self):
        self.driver.find_element_by_xpath("//android.widget.TextView[@text='同意']").click()
        self.driver.find_element_by_id("com.xueqiu.android:id/tv_search").click()
        self.driver.find_element_by_id("com.xueqiu.android:id/search_input_text").send_keys("alibaba")
        self.driver.find_element_by_xpath("//android.widget.TextView[@text='阿里巴巴']").click()
        current_price = float(self.driver.find_element_by_id("com.xueqiu.android:id/current_price").text)
        print((current_price))
        assert current_price > 150


if __name__ == '__main__':
    pytest.main()



↙↙↙阅读原文可查看相关链接,并与作者交流