• python代码
    作业:搜索 -> 输入小米 -> 点击股票类型 -> 点击小米股票


    class (contactAndiroidTests(unittest.TestCase)):
    def setUp(self):

    caps = {}
    caps["platformName"] = "android"
    caps["deviceName"] = "hogwarts"
    caps["appPackage"] = "com.xueqiu.android"
    caps["appActivity"] = ".view.WelcomeActivityAlias"

    self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
    self. driver.implicitly_wait(5)
    def test_demo(self):
    self.driver.find_element_by_id("tab_icon").click()
    self.driver.find_element_by_id("tv_search").click()
    self.driver.find_element_by_id("search_input_tex").send_keys("xiaomi")
    self.driver.find_element_by_xpath("(//android.widget.TextView[@text='股票'])[1]").click()

    # def terDown(self):
    # self.driver.close()
    # self.driver .quit()


    if __name__ == '__main__':
    unittest.main()
  • python代码
    ##主页面的个人信息图标 -> 登录雪球 -> 手机及其他登陆 -> 邮箱手机号登陆 -> 输入用户名密码


    from appium import webdriver

    caps = {}
    caps["platformName"] = "android"
    caps["deviceName"] = "hogwarts"
    caps["appPackage"] = "com.xueqiu.android"
    caps["appActivity"] = ".view.WelcomeActivityAlias"

    driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)

    el1 = driver.find_element_by_id ("user_profile_icon")
    el1.click()
    el2 = driver.find_element_by_id("tv_login")
    el2.click()
    el3 = driver.find_element_by_id("/tv_login_by_phone_or_others")
    el3.click()
    el4 = driver.find_element_by_id("tv_login_with_account")
    el4.click()
    el5 = driver.find_element_by_id("login_account")
    el5.click()
    el6 = driver.find_element_by_id("login_account")
    el6.send_keys("alibaba")
    el7 = driver.find_element_by_id("id/login_password")
    el7.send_keys("123123")

    driver.quit()