zoukankan      html  css  js  c++  java
  • appium 学习记录

    环境搭建
      java 和 Android-SDK
      sdkmanager 安装 SDK-Tools platform-tools build-tools
      最少安装一个版本的 sdk-platform

      Node.js安装

      Appium-desktop
      Appium-client(pip安装 或者 github上下载安装)

    uiautomatorviewer 自己截图 定位

    adb shell uiautomator dump /sdcard/app.uix
    adb pull /sdcard/app.uix F:/app.uix
    
    adb shell screencap -p /sdcard/app.png
    adb pull /sdcard/app.png F:/app.png
    

     

    获取packageName  和 入口activity  aapt dump badging //path   
    		cmd需要cd  到path 去, 不然 可能会“dump failed because no AndroidManifest.xml found”
    
    或者  打印手机日志   adb logcat -v time -s ActivityManager | findstr name=
    

      

    定位
    driver.find_element_by_id('com.tencent.mobileqq:id/btn_login') 
    driver.find_element_by_xpath('//android.widget.EditText[@content-desc="请输入QQ号码或手机或邮箱"]')
    driver.find_element_by_accessibility_id('请输入QQ号码或手机或邮箱')   content-desc
    
    AndroidUiautomator定位
    # 包含text文字
    driver.find_element_by_android_uiautomator('new UiSelector().textContains("机")')
    # 以text什么开始
    driver.find_element_by_android_uiautomator('new UiSelector().textStartsWith("手")')
    # 正则匹配text
    driver.find_element_by_android_uiautomator('new UiSelector().textMatches("^手.*")')
     
    # className
    driver.find_elements_by_android_uiautomator('new UiSelector().className("android.widget.TextView")')
    # classNameMatches
    driver.find_elements_by_android_uiautomator('new UiSelector().classNameMatches("^android.widget.*")')
     
    # resource-id、resourceIdMatches
    driver.find_element_by_android_uiautomator('new UiSelector().resourceId("com.syqy.wecash:id/et_content")')
     
    # description
    driver.find_element_by_android_uiautomator('new UiSelector().description("S 日历")')
    # descriptionStartsWith
    driver.find_element_by_android_uiautomator('new UiSelector().descriptionStartsWith("日历")')
    # descriptionMatches
    driver.find_element_by_android_uiautomator('new UiSelector().descriptionMatches(".*历$")')
    竹杖芒鞋轻胜马,一蓑烟雨任平生。 回首向来萧瑟处,也无风雨也无晴。
  • 相关阅读:
    Ubuntu 16 安装redis客户端
    crontab 参数详解
    PHP模拟登录发送闪存
    Nginx配置端口访问的网站
    Linux 增加对外开放的端口
    Linux 实用指令之查看端口开启情况
    无敌的极路由
    不同的域名可以指向同一个项目
    MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error
    Redis 创建多个端口
  • 原文地址:https://www.cnblogs.com/yaobiluo/p/12779451.html
Copyright © 2011-2022 走看看