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

做么网站有黄医疗机构网站备案

做么网站有黄,医疗机构网站备案,网页设计素材景区结束,商城型网站开发网站建设浅尝Appium自动化框架 Appium自动化框架介绍Appium原理Appium使用安装平台驱动实战 坑 Appium自动化框架介绍 Appium 是一个开源的自动化测试框架#xff0c;最初设计用于移动应用的测试#xff0c;但现在它也扩展了对桌面端应用的支持。Appium 使得自动化测试变得更加简单最初设计用于移动应用的测试但现在它也扩展了对桌面端应用的支持。Appium 使得自动化测试变得更加简单并且支持跨平台能够同时对 iOS、Android、Windows 和 macOS 平台上的应用进行自动化测试。 不同于Selenium只是用来自动化测试web程序Appium可以自动化测试各个平台的原生应用。 官网 Appium原理 ------------------ | Test Scripts | | (Java, Python, | | JavaScript) | -----------------|v ----------------- | Appium Server | | (HTTP Server) | -----------------|------------------------------------------------------------------| | | |v v v v ------------ ------------- -------------- -------------- | iOSDriver | | AndroidDriver | | WindowsDriver | | macOSDriver | | XCUITest | | (UIAutomator) | | (WinAppDriver)| | (macOSDriver)| ------------ ------------- -------------- --------------| | | | ------------ ------------- -------------- -------------- | iOS App | | Android App| | Windows App| | macOS App | ------------ ------------- -------------- -------------- Test Scripts 测试脚本可以使用不同编程语言编写如 Java、Python 或 JavaScript向 Appium Server 发送 HTTP 请求。Appium Server Appium Server 是一个 HTTP 服务器负责接收客户端的请求并将请求转发给相应的平台驱动程序。平台驱动 iOSDriver 用于 iOS 平台支持通过 XCUITest 或 UIAutomation 与 iOS 设备交互。 AndroidDriver 用于 Android 平台支持通过 UIAutomator 或 Espresso 与 Android 设备交互。 WindowsDriver (WinAppDriver) 用于 Windows 平台支持通过 WinAppDriver 进行桌面应用的自动化测试。 macOSDriver 用于 macOS 平台支持通过 macOSDriver 进行桌面应用的自动化测试。应用 驱动程序与设备或模拟器上的应用进行交互执行各种操作如启动应用、查找元素、点击、输入等。 Appium使用 安装平台驱动 驱动平台适用场景uiautomator2Android原生 Android 应用自动化xcuitestiOS原生 iOS 应用自动化espressoAndroid适用于使用 espresso 框架的 Android 应用mac2macOSmacOS 应用自动化桌面应用windowsWindowsWindows 应用自动化桌面应用safariiOSiOS Safari 浏览器自动化geckoAndroid, iOSFirefox 浏览器自动化chromiumAndroid, macOS, WindowsChromium 浏览器自动化包括 Chrome 比如 安装mac驱动 appium driver install mac2安装后可以用如下命令看是否安装成功。 appium driver list --installed实战 玩了2天发现Appium对mac和win上的桌面应用支持的并不是太好至少兼容性一般。后面我就转到测试android手机上的应用。写了小demo玩玩打开QQ找到某某人发送特定消息。 import timefrom appium import webdriver from appium.options.android import UiAutomator2Options from appium.webdriver.common.appiumby import AppiumBy# Desired Capabilities 配置 desired_caps dict(platformNameAndroid,platformVersion14,deviceNameRFCT20EGLNJ,automationNameUiAutomator2,appPackagecom.tencent.mobileqq,appActivitycom.tencent.mobileqq.activity.SplashActivity,enforceXPath1True,noResetTrue )# 连接 Appium Server driver webdriver.Remote(http://127.0.0.1:4723, options UiAutomator2Options().load_capabilities(desired_caps))try:# 等待并点击搜索按钮search_button driver.find_element(AppiumBy.ID, com.tencent.mobileqq:id/wwk)search_button.click()time.sleep(2)# 等待搜索输入框并输入 QQ 号码search_layout driver.find_element(AppiumBy.ID, com.tencent.mobileqq:id/jo9)location search_layout.locationsize search_layout.size# 点击搜索框聚焦driver.tap([(location[x] size[width] / 2, location[y] size[height] / 2)], 500)# 输入qq号码driver.press_keycode(16)driver.press_keycode(10)driver.press_keycode(9)driver.press_keycode(16)# 点击qq用户user_list_layout driver.find_element(AppiumBy.XPATH, (//android.widget.LinearLayout[resource-idcom.tencent.mobileqq:id/ecl])[1])# user_button user_list_layout.find_element(AppiumBy.ANDROID_UIAUTOMATOR, text(freedom-studio)) # 可以定位精确匹配user_button user_list_layout.find_element(AppiumBy.ANDROID_UIAUTOMATOR, new UiSelector().textContains(freedom)) # 可以定位模糊匹配# user_button user_list_layout.find_element(AppiumBy.XPATH, .//*[contains(text(), freedom)]) # 无法定位user_button.click()time.sleep(2)# 找到聊天输入框msg_input driver.find_element(AppiumBy.ID, com.tencent.mobileqq:id/input)msg_input.send_keys(hello)# 找到发送按钮send_button driver.find_element(AppiumBy.ID, com.tencent.mobileqq:id/send_btn)send_button.click()print(Message sent successfully!)finally:# 退出会话driver.quit()期间要用到Appium Inspector这个工具就是用来定位元素的。 记得要先安装adb工具哦。 其中 appium:deviceName设备名可以通过adb devices获取。 adb devicesappium:appPackage应用包名和appium:appActivity应用界面可以通过如下adb命令获取。 adb shell dumpsys window | grep mCurrentFocus最右边的Selected Element里就有xpathid等信息。如果没有也别感到意外那就是没有只能通过其他方法定位元素了。 比如代码里的 # user_button user_list_layout.find_element(AppiumBy.ANDROID_UIAUTOMATOR, text(freedom-studio)) # 可以定位精确匹配 user_button user_list_layout.find_element(AppiumBy.ANDROID_UIAUTOMATOR, new UiSelector().textContains(freedom)) # 可以定位模糊匹配 # user_button user_list_layout.find_element(AppiumBy.XPATH, .//*[contains(text(), freedom)]) # 无法定位理论上从Appium Inspector里看结构很清晰XPath肯定是可以定位到的但是实际就是不行那只能试试其他方法了比如AppiumBy.ANDROID_UIAUTOMATOR。 坑 玩Appium也遇到不少坑。 Appium对桌面应用程序支持的并不是非常好主要还是用来做手机应用的自动化。比如在mac或者win上Appium Inspector经常无法定位特定元素。我们一般使用ID, XPath来定位元素但是有时候定位不到那也只能另辟蹊径比如用位置坐标来定位再比如用ANDROID_UIAUTOMATOR等等。测试设备是要和启动appium server的机器连接在一起的。
http://www.w-s-a.com/news/70063/

相关文章:

  • 企业年金是1比3还是1比4北京厦门网站优化
  • 政务信息网站建设工作方案云南建设工程质量监督网站
  • 如何做一份企业网站免费的短视频素材库
  • 云脑网络科技网站建设咸阳软件开发
  • seo对网站优化网站更换程序
  • 网站建设放什么科目中小学生在线做试卷的网站6
  • 网站建设推广公司排名绥化建设局网站
  • 凡科做的网站为什么打不开苏州行业网站建设
  • 南昌定制网站开发费用微信小商店官网入口
  • 深圳网站建设费用找人做的网站怎么看ftp
  • 做网站cookie传值dedecms网站后台
  • 温州网站推广网站建设要学会什么
  • c 网站开发框架品牌策划方案范文
  • 儿童摄影作品网站多元网络兰州网站建设
  • 电脑上不了建设厅网站常德网站建设费用
  • 做单页免费模板网站最新办公室装修风格效果图
  • 中国铁路建设投资公司网站熊学军想开网站建设公司
  • 优化一个网站多少钱网站开发北京
  • html教学关键词优化价格
  • 黄冈论坛网站有哪些给wordpress首页添加公告栏
  • 初中做数学题的网站做淘宝必备网站
  • 买拆车件上什么网站谁有那种手机网站
  • 一家专做有机蔬菜的网站万户网络是干嘛的
  • 十堰百度网站建设八宝山做网站公司
  • 地区电商网站系统建筑施工图纸培训班
  • 网站外包维护一年多少钱医院网站 功能
  • 电子商务市场的发展前景seo推广平台服务
  • 乐清网页设计公司哪家好seo推广任务小结
  • 360建筑网是什么pc优化工具
  • 越秀免费网站建设风景区网站建设项目建设可行性