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 @ 2024-06-29 03:05  soulorelax  阅读(3)  评论(0编辑  收藏  举报