Live2D

Python+selenium+appium

  1. 启动Appium-GUI 点击 启动服务器
  2. 启动模拟器Genymotion

    3. 在命令行窗口adb devices 查看模拟器IP
  3. 打开pycharm编写简单脚本如下
点击查看代码
from  appium import webdriver
#import unittest

desired_caps={}
desired_caps['platformName']='Android'
desired_caps['deviceName']='192.168.29.102:5555'
desired_caps['platforVersion']='5.1.1'
desired_caps['appPackage']='com.android.calculator2'
desired_caps['appActivity']='com.android.calculator2.Calculator'

driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)

#driver.find_element_by_id('com.android.calculator2:id/del').click()
driver.find_element_by_android_uiautomator('text("7")').click()
driver.find_element_by_android_uiautomator('text("+")').click()
driver.find_element_by_android_uiautomator('text("9")').click()
driver.find_element_by_android_uiautomator('text("=")').click()
s=driver.find_element_by_id('com.android.calculator2:id/result').text
assert s=='16'
if s=='16':
    print("计算结果正确")

  1. 运行脚本观察模拟器变化
  2. 查看控制台运行情况
posted @   soulorelax  阅读(23)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 提示词工程——AI应用必不可少的技术
· 地球OL攻略 —— 某应届生求职总结
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界
xxx2760天4小时17分54秒
点击右上角即可分享
微信分享提示