当前位置: 首页 > news >正文

Appium学习

      一、基础配置

import unittest
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ECcapabilities = {'platformName': 'Android','automationName': 'uiautomator2','deviceName': '127.0.0.1:21503',#连接的设备名称'appPackage': 'com.tjlianxin.smartcanteen363',#要测试的包名'appActivity': 'com.lianxin.smartcanteenposc7.ui.spflash.SpflashActivity',#要测试包名的主活动名称'language': 'zh','locale': 'CN'
}appium_server_url = 'http://localhost:4723/wd/hub'class TestAppium(unittest.TestCase):def setUp(self) -> None:self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))def tearDown(self) -> None:if self.driver:self.driver.quit()def test_find_battery(self) -> None:wait = WebDriverWait(self.driver, 10)el = wait.until(EC.presence_of_element_located((AppiumBy.XPATH, '//*[@text="确定"]')))el.click()if __name__ == '__main__':unittest.main()

1.appPackage名可以使用下面的adb命令来查询所有的包名,找到你要测试程序的包名

adb shell pm list packages

2.appActivity界面主活动名称可以使用下面的语句查询包名的主活动界面名称,注意:com.tjlianxin.smartcanteen363需要替换为你测试程序的包名

adb shell dumpsys package com.tjlianxin.smartcanteen363

查询完成之后会显示出很多的数据,找到MAIN或者是LAUNCHER这两个字符,我找出来的是这样的,取出上面的包名的活动名称

      android.intent.action.MAIN:e4653d com.tjlianxin.smartcanteen363/com.lianxin.smartcanteenposc7.ui.spflash.SpflashActivity filter 2346502Action: "android.intent.action.MAIN"Category: "android.intent.category.LAUNCHER"

 那么你得实际活动名就是:

com.lianxin.smartcanteenposc7.ui.spflash.SpflashActivity

http://www.lryc.cn/news/428950.html

相关文章:

  • 回顾 | 瑞云科技亮相ICIC2024,虚拟仿真实训云平台引关注
  • libLZMA库iOS18平台编译
  • 《AI办公类工具PPT系列之二——iSlide AI》
  • C语言基础(六)
  • 什么是词向量?如何得到词向量?Embedding 快速解读
  • AI视频创作应用
  • JAVA常见的工具类之Object类(超详细)
  • 深度学习(YOLO、DETR) 十折交叉验证
  • 基于php网上差旅费报销系统设计与实现
  • 微服务及安全
  • 图文详解ThreadLocal:原理、结构与内存泄漏解析
  • 基于java的综合小区管理系统论文.doc
  • 如何合理设置PostgreSQL的`max_connections`参数
  • Kubectl 常用命令汇总大全
  • 【Linux】Linux环境基础开发工具使用之Linux调试器-gdb使用
  • clickhouse_driver
  • BI分析实操案例分享:零售企业如何利用BI工具对销售数据进行分析?
  • python : Requests请求库入门使用指南 + 简单爬取豆瓣影评
  • 宋红康JVM调优思维导图
  • linux 网卡配置
  • IEEE |第五届机器学习与计算机应用国际学术会议(ICMLCA 2024)
  • 【网络安全】漏洞挖掘:IDOR实例
  • vue项目执行 cnpm install 报错证书过期的解决方案
  • XGboost的安装与使用
  • 【AI趋势9】开源普惠
  • 【Spark集群部署系列一】Spark local模式介绍和搭建以及使用(内含Linux安装Anaconda)
  • 泛微OA 常用数据库表
  • 宜佰丰超市进销存管理系统
  • 生成Vue脚手架报错:npm error code ETIMEDOUT
  • Readiness Probe可以解决应用启动慢造成访问异常的问题。