zoukankan      html  css  js  c++  java
  • Appium-We wanted {"required":["value"]} and you sent ["text","sessionId","id","value"]

    APK 链接:https://pan.baidu.com/s/17oeTM1qA0QjPBqLh6pS0Yg 
    提取码:s9ru


    # coding:utf-8
    from appium import webdriver
    import time,traceback
    desired_caps = {}
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '4.4.4'
    desired_caps['deviceName'] = 'test'
    desired_caps['app'] = r'c:/Appium/toutiao.apk'
    desired_caps['appPackage'] = 'io.manong.developerdaily'
    desired_caps['appActivity'] ='io.toutiao.android.ui.activity.LaunchActivity'
    desired_caps['unicodeKeyboard'] = True
    desired_caps['resetKeyboard'] = True
    desired_caps['noReset'] = True
    desired_caps['newCommandTimeout'] = 6000


    driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
    driver.implicitly_wait(15)
    try:
    driver.find_element_by_class_name("android.widget.ImageButton")
    time.sleep(5)
    xpath = '//*[@resource-id = "io.manong.developerdaily:id/tab_bar"]//android.widget.RelativeLayout[5]//android.widget.TextView'
    driver.find_element_by_xpath(xpath).click()


    # eles = driver.find_elements_by_xpath('//*[@resource_id="io.manong.developerdaily:id/tab_bar"]//android.widget.TextView')
    # for ele in eles:
    # print ele.text
    # eles[3].click() #python


    time.sleep(3)
    driver.find_element_by_id('io.manong.developerdaily:id/login_btn').click()
    time.sleep(2)
    driver.find_element_by_xpath('//*[@resource-id="io.manong.developerdaily:id/tab_layout"]//android.widget.RelativeLayout[2]//android.widget.TextView').click()
    ele = driver.find_element_by_id('io.manong.developerdaily:id/edt_phone')
    ele.set_value('13717617074')
    time.sleep(3)
    ele = driver.find_element_by_id('io.manong.developerdaily:id/edt_password')
    ele.set_value('mao112233')
    time.sleep(2)
    driver.find_element_by_id('io.manong.developerdaily:id/btn_login').click()
    except:
    print traceback.print_exc()
    input('****Press to quit..')
    driver.quit()











    send_keys () 参数不正确问题解决

    参考:https://www.cnblogs.com/crstyl/articles/7266341.html

  • 相关阅读:
    用YSLOW分析页面速度
    字节与字符的区别
    五小步大幅提高firefox页面加载速度【转载】
    Asp.netUpload(大文件上传) 终于找到一个可以用的了
    (续), 这个是我比较满意的
    共享一些变态的签名,希望不太OLD
    C#入门代码
    最后是所有的附件和一些他们的文章
    JavaScript日期处理函数大全
    加密解密Url的类
  • 原文地址:https://www.cnblogs.com/hyzhang/p/10697223.html
Copyright © 2011-2022 走看看