zoukankan      html  css  js  c++  java
  • Appium脚本(3):sendkey(封装capability)

    输入中文注意添加这个配置,否正中文输入不了
    desired_caps['unicodeKeyboard'] = "True"
    desired_caps['resetKeyboard'] = "True"

    capability.py

     1 from appium import webdriver
     2 
     3 desired_caps = {}
     4 desired_caps['platformName'] = 'Android'
     5 desired_caps['deviceName'] = '127.0.0.1:62001'
     6 desired_caps['platforVersion'] = '5.1.1'
     7 
     8 # 真机配置
     9 # desired_caps['deviceName']='MX4'
    10 # desired_caps['platforVersion']='5.1'
    11 # desired_caps['udid']='750BBKL22GDN'
    12 
    13 # desired_caps['app'] = r'C:python_dirappskaoyan3.1.0.apk'
    14 desired_caps['appPackage'] = 'com.tal.kaoyan'
    15 desired_caps['appActivity'] = 'com.tal.kaoyan.ui.activity.SplashActivity'
    16 
    17 # 重置开关,默认false,默认每次如第一次安装好的状态
    18 desired_caps['noReset'] = 'True'
    19 
    20 # 中文输入
    21 desired_caps['unicodeKeyboard'] = "True"
    22 desired_caps['resetKeyboard'] = "True"
    23 
    24 driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    25 driver.implicitly_wait(3)

    sendkey_3.py

     1 from app.find_element.capability import driver
     2 
     3 accunt_input = driver.find_element_by_id('com.tal.kaoyan:id/login_email_edittext')
     4 accunt_input.clear()
     5 accunt_input.send_keys("账号123")
     6 passwd_input = driver.find_element_by_id('com.tal.kaoyan:id/login_password_edittext')
     7 passwd_input.send_keys('123')
     8 driver.implicitly_wait(3)
     9 driver.find_element_by_id('com.tal.kaoyan:id/login_login_btn').click()
    10 
    11 driver.close_app()
  • 相关阅读:
    ArrayList.sort & Collections.sort
    preliminary->advanced exam coding part
    Spring JDBC的使用
    Spring之面向切面编程(AOP)
    Spring静态代理与动态代理
    Spring之JDBC的连接与注解的使用
    Spring入门之Bean的实例化方式
    Mybatis入门(二)
    Mybatis入门(一)
    正则表达式——转载
  • 原文地址:https://www.cnblogs.com/gongxr/p/10911578.html
Copyright © 2011-2022 走看看