appium

appium定位元素

家住魔仙堡 提交于 2020-01-25 11:23:28
一、常用识别元素的工具 uiautomator:Android SDK自带的一个工具,在tools目录下 monitor:Android SDK自带的一个工具,在tools目录下 Appium Inspector:Appium自带的一个功能,只有mac下可以使用该功能 下面是用monitor抓取到的页面元素 下面使用Appium Inspector定位的元素 二、元素定位 1.格式:find_element_by_定位方式(value) 通过id定位 (取resource-id的值): driver.find_element_by_id("com.wuba.zhuanzhuan:id/azo") 也可以直接用id后面的内容driver.find_element_by_id("azo") 通过class_name定位 (取class的内容) driver.find_element_by_class_name("android.widget.RelativeLayout") 通过xpath定位 (取xpath得内容) driver.find_element_by_xpath("//android.widget.LinearLayout[1]/android.widget.XXX") 通过text定位 (需要使用uiautomator的定位方式,使用text的内容) driver

appium自动化之手势操作总结(附带手势解锁)

☆樱花仙子☆ 提交于 2020-01-25 11:19:20
说说常用appium做自动化经常会用到的手势操作。 声明:所有的手势操作都会用到这个模块 from appium.webdriver.common.touch_action import TouchAction 操作时都得传入driver对象,执行时都用上.perfrom()才能生效,使用move_to根据坐标移动手势,记得打开开发者模式里面的指针位置 1:轻敲 tap,类似于click点击 使用方法:可以传元素或者是坐标 # todo 传元素点击轻敲 TouchAction(driver).tap(more_button).perform() todo 传坐标点击 TouchAction(driver).tap(x=680,y=1045).perform() 2:按压 press 使用方法:可以传元素或者是坐标 el = driver.find_element_by_xpath('//*[@text="开放源代码许可"]') # todo 按压5秒后释放 TouchAction(driver).press(el).wait(5000).release().perform() 3:长按 long_press 使用方法:可以传元素或者是坐标 # todo 长按6秒 el = driver.find_element_by_xpath('//*[@text="WiredSSID"]')

Appium+python自动化(二十九)- 模拟手指在手机上多线多点作战 - 多点触控(超详解)

回眸只為那壹抹淺笑 提交于 2020-01-25 11:18:59
简介 在网页中我们经常使用缩放操作来便利的查看具体的信息,在appium中使用MultiAction多点触控的类来实现。MultiAction是多点触控的类,可以模拟用户多点操作。主要包含加载add()和执行perform()两个方法. 问题思考 在使用地图 App中,我们经常需要对界面进行缩放操作来更加便利的查看位置。那么在Appium中怎样去模拟这类操作呢? MultiAction MultiAction 是多点触控的类,可以模拟用户多点操作。主要包含 add() 和 perform() 两个方法, MultiAction可以结合前面所学的 ActionTouch 可以模拟出用户的多个手指滑动的操作效果; MultiAction一般和TouchAction结合使用,故需要导入以下模块: from appium.webdriver.common.multi_action import MultiAction from appium.webdriver.common.touch_action import TouchAction 加载: 方法 add(self, *touch_actions)将TouchAction对象添加到MultiAction中,稍后再执行。 参数: touch_actions - 一个或多个TouchAction对象,描述一个手指要执行的动作链 用法 a1

Appium throws an error because of the driver

▼魔方 西西 提交于 2020-01-25 08:33:48
问题 I am trying to run automated test with appium, but I always get the following error : FAILED: f java.lang.NoSuchMethodError: org.openqa.selenium.remote.http.HttpClient$Factory.createDefault()Lorg/openqa/selenium/remote/http/HttpClient$Factory; I've noticed that if I delete everything from the driver declaration to the bottom, the test is successful. Here is my code : package test; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.By; import org.openqa

APP自动化测试的环境配置

丶灬走出姿态 提交于 2020-01-25 02:53:18
什么是Appium? 第三方自动化框架(工具),扩充了selenium webdriver 协议,在原有的基础上添加了移动端测试API selenium webdriver 指定了客户端到服务端的协议 appium 是一个开源的、跨平台的自动化测试工具,用于app的自动化测试 appium 是跨平台的,支持android,ios,firefoxos等操作系统下的app测试 什么是selenium? 用于web应用程序测试工具,直接运行在浏览器,模拟用户操作,覆盖Windows、Linux、Mac,覆盖 IE、Chrome、firefox等浏览器,Java、Python多种语言进行脚本编写 官网: https://docs.seleniumhq.org/download/ 版本: http://selenium-release.storage.googleapis.com/index.html 什么情况适合做自动化: 周期比较长的、需求比较稳定的、迭代周期比较长的 使用appium 做APP自动化测试的原理: 1)appium 的核心其实是一个暴露了一系列rest api的server 2)这个server的功能其实很简单:监听一个端口(4723),然后接受由client发送的command 3)然后翻译 这些command,把这些command

Appium自动化测试框架研究(2)——搭建IOS环境

偶尔善良 提交于 2020-01-24 07:03:08
今天的文章讲 iOS 的A ppium 环境搭建。 对于 iOS 而言,只能在 Mac 笔记本上安装 Appium ,以及所需要的各种组件。 也许有人会问,能否在 Windows 系统上使用 Appium 测试 iOS 手机,这不就不用花钱买 Mac 了吗?答案是不可以,因为 Appium 的本质是把我们编写的自动化测试脚本,翻译成 Mac 中 UIAutomator 的脚本,所以只能 Mac 来做, W indows 系统搞不定。但是,你可以装黑苹果来解决这个问题。 我们这篇文章不提黑苹果,而是介绍怎么在 mac 笔记本上安装能运行 iOS 自动化测试的 appium 。 以下的 6 个步骤,在上一篇文章我们已经介绍过,请参考上一篇文章。。 1 )安装 Node 。 2 )使用 Node 下载 Appium Server 。 3 )下载并安装 Appium Desktop. 4 )下载并安装 Python 3 。 5 )使用 pip 下载 Appium Client 。 6 )安装 Appium Doctor 。 为什么说 iOS 支持 Appium 麻烦呢,因为还要执行下列的步骤: 1 )安装最新版的 XCode ,去 App Store 下载并安装最新版即可 要确保 XCode 的版本和 IPhone 的版本是兼容的,否则就升级系统。 2 )安装 Xcode Command

XCUITest Simulator architecture appears to be unsupported by the Appium

守給你的承諾、 提交于 2020-01-23 14:40:05
问题 I am trying to test my react native iOS app in saucelabs(appium). Saucelabs require a file zip of .app folder created after the xcode build. I am using following steps(bitrise steps) to create the .app folder and the zip file. 1) Set Xcode Project Build Number 2) Xcode Archive & Export for iOS Once the zip file is created it is uploadedin the saucelabs. When I execute the tests in saucelabs, I get the following error from the appium server. > 2018-06-20 08:58:53:668 - [XCUITest] *************

appium远程调用appium server

こ雲淡風輕ζ 提交于 2020-01-23 14:08:36
如何通过本地的代码,调用远程的server呢? 例如:我有两台电脑A(192.168.112.10)和B(192.168.112.11),那我怎么能在A执行本地脚本,但是使用B上的server呢? 查看appium连接appium服务并开启一个session的例子如下: desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = ‘4.4' desired_caps['deviceName'] = '1d543708' desired_caps['appPackage'] = 'com.wuba.zhuanzhuan' desired_caps['appActivity'] = '.presentation.view.activity.LaunchActivity' driver = webdriver.Remote(' http://127.0.0.1:4723/wd/hub ', desired_caps) 可以看到实际是通过 ' http://127.0.0.1:4723/wd/hub ' 这个地址连接到appium server的,那如果我要连接远程server,只要做如下操作即可 实现方法 以A要使用B的服务为例 1

appium环境搭建及项目实战

点点圈 提交于 2020-01-23 03:31:19
手机端自动化环境搭建比其他自动化环境搭建较为复杂,安装工具有点多,也会有很多坑,安装工具一定注意版本号对应问题。 一、我的电脑环境:win7 64位,安卓测试机4.4.2版本,Python3.6,appium1.4,java1.7 二、环境安装: java环境安装安装就不讲了 (1)安装appium,地址: https://bitbucket.org/appium/appium.app/downloads/ 解压后一步步安装,桌面会有appium的快捷方式 appium安装好后,找到这个文件目录D:\andriod\anzhaung\appiumZIP\Appium\node_modules\.bin(这是我的安装目录) 将上面的地址添加到环境变量path下 打开cmd,输入appium-doctor,检查环境是否OK,出现如下图所示,说明环境OK (2) 安装Android SDK,地址: http://dl.google.com/android/installer_r23.0.2-windows.exe 安装完成后添加环境变量,在系统变量新建:ANDROID_HOME,对应变量值为:D:\android(sdk安装路径) 在系统变量找到path编辑,添加下面俩个变量: ;%ANDROID_HOME%\platform-tools;ANDROID_HOME%\tools; (3

appium之安卓7.0环境搭建

左心房为你撑大大i 提交于 2020-01-23 01:28:47
appium 在安卓7.0的手机上运行上报错---------Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.settings without first uninstalling.] 解决方法: 进入Appium安装目录,找到目录下的adb.js(D:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js) adb.js 中1035 行( 出错原因:this.shell("ps '" + name + "'", function (err, stdout) {对应执行的指令是ps 'uiautomator', Android7不支持这个指令格式,所以执行结果是bad pid 'uiautomator' ) this.shell("ps '" + name + "'", function (err, stdout) { if (err) return cb(err); 替换成 this.shell_grep("ps", name, function (err, stdout) { if (err) { logger.debug("No matching processes