Appium_py_切换首页分类

  • #coding=utf-8
    from appium import webdriver
    desired_caps = {}
    desired_caps[‘platformName’] = ‘Android’
    desired_caps[‘platformVersion’] = ‘4.4.2’
    desired_caps[‘deviceName’] = ‘24c151c8’
    desired_caps[‘appPackage’] = ‘com.aaa.bbb’
    desired_caps[‘appActivity’] = ‘.SplashActivity’
    driver = webdriver.Remote(‘http://localhost:4723/wd/hub‘, desired_caps)
    driver.wait_activity(“.MainActivity”,6,2)
    fenlei_names = driver.find_elements_by_class_name(“android.widget.TextView”)
    print fenlei_names[1].text
    fenlei_names[1].click()
    fenlei_names[2].click()
    driver.find_element_by_xpath(“//android.widget.TextView[contains(@text,’男装’)]”).click()
    driver.find_element_by_xpath(“//android.widget.TextView[contains(@text,’数码家电’)]”).click()
    driver.quit()

你可能感兴趣的:(Appium)