当前位置:   article > 正文

Appium+ADB TOOLS检测android版本,复制APK到电脑,查看APP的主activity以及生成java.C#配置代码,appium Capability,uiautomatorvie

Appium+ADB TOOLS检测android版本,复制APK到电脑,查看APP的主activity以及生成java.C#配置代码,appium Capability,uiautomatorvie

常用APP(apk)对应包名

 

关于设置:

adb,aapt,uiautomaorviewr可配置,配置正确即可以找到文件启动用户配置,不正确使用程序自带配置。

(所有操作指令及结果都会输出到日志列表)

自动显示设备列表,模拟器或者真机。显示手机上安装的第三方程序和系统程序(可设置)

可以直接将手机端的app安装包复制到电脑,用于检测app。

aapt dump badging E:\Project\头脑王者\adbTools\bin\AdbToolsExe\AppPackge\cn.xuexi.android\base.apk

直接选择要操作的app安装程序就可以获取packge和主activity。

生成python、java和c#appium自动化测试链接代码

 

  1. # Python
  2. from appium import webdriver
  3. caps = {}
  4. caps["platformName"] = "Android"
  5. caps["platformVersion"] = "9.0.0"
  6. caps["deviceName"] = "Mi_Note_3"
  7. caps["appPackage"] = "com.antfortune.wealth"
  8. caps["appActivity"] = "com.alipay.mobile.quinox.LauncherActivity"
  9. caps["resetKeyboard"] = True
  10. caps["unicodeKeyboard"] = True
  11. driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
  12. driver.find_element_by_id("com.antfortune.wealth.login:id / login_main_button").click()
  13. driver.quit()
  14. //C# AND JAVE CODE,C# Need Change 'setCapability' to 'SetCapability'
  15. //C#
  16. DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
  17. desiredCapabilities.SetCapability("platformName", "Android");
  18. desiredCapabilities.SetCapability("appPackage", "cn.xuexi.android");
  19. desiredCapabilities.SetCapability("deviceName", "293d23a8");
  20. //SetCapability(MobileCapabilityType.DeviceName,"293d23a8");
  21. desiredCapabilities.SetCapability("platformVersion", "10");
  22. desiredCapabilities.SetCapability("appActivity", "com.alibaba.android.rimet.biz.SplashActivity");
  23. desiredCapabilities.SetCapability("resetKeyboard", true);
  24. desiredCapabilities.SetCapability("automationName", "UiAutomator2");
  25. desiredCapabilities.SetCapability("noReset", true);
  26. desiredCapabilities.SetCapability("ensureWebviewsHavePages", true);
  27. RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new Uri("http://127.0.0.1:4723/wd/hub"), desiredCapabilities);
  28. //JAVA
  29. DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
  30. desiredCapabilities.setCapability("platformName", "Android");
  31. desiredCapabilities.setCapability("appPackage", "cn.xuexi.android");
  32. desiredCapabilities.setCapability("deviceName", "293d23a8");
  33. desiredCapabilities.setCapability("platformVersion", "10");
  34. desiredCapabilities.setCapability("appActivity", "com.alibaba.android.rimet.biz.SplashActivity");
  35. desiredCapabilities.setCapability("resetKeyboard", true);
  36. desiredCapabilities.setCapability("automationName", "UiAutomator2");
  37. desiredCapabilities.setCapability("noReset", true);
  38. desiredCapabilities.setCapability("ensureWebviewsHavePages", true);
  39. AndroidDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub", desiredCapabilities);

生成appium Capability设置

  1. {
  2. "deviceName": "293d23a8",
  3. "platformName": "Android",
  4. "platformVersion": "10",
  5. "appPackge": "cn.xuexi.android",
  6. "appActivity": "com.alibaba.android.rimet.biz.SplashActivity"
  7. }

使用uiautomatorviewer 完美解决 Error obtaining UI hierarchy 

自动保存页面,方便调试使用。

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/288749
推荐阅读
相关标签
  

闽ICP备14008679号