Appnium-API-Dvice
Device
Activity
Start Activity
Start an Android activity by providing package name and activity name
Java:driver.startActivity(new Activity("com.example", "ActivityName"));
Python:self.driver.start_activity("com.example", "ActivityName");
Get Current Activity
Get the name of the current Android activity
Java:String activity = driver.currentActivity();
Python:activity = self.driver.current_activity;
Get Current Package
Get the name of the current Android package
Java:String package = driver.getCurrentPackage();
Python:package = self.driver.current_package;
Install App
Install the given app onto the device
Java:driver.installApp("/Users/johndoe/path/to/app.apk");
Python:self.driver.install_app('/Users/johndoe/path/to/app.apk');
Is App Installed
Check whether the specified app is installed on the device
Java:driver.isAppInstalled("com.example.AppName");
Python:self.driver.is_app_installed('com.example.AppName');
Launch an App
Launch an app on device
Java:driver.launchApp();
Python:self.driver.launch_app()
Background App
Send the currently running app for this session to the background
Java:driver.runAppInBackground(Duration.ofSeconds(10));
Python:self.driver.background_app(10)
Close an App
Close an app on device
Java:driver.closeApp();
Python:self.driver.close_app()
Reset App
Reset the currently running app for this session
Java:driver.resetApp();
Python:self.driver.reset()
Remove App
Remove an app from the device
Java:driver.removeApp("com.example.AppName");
Python:self.driver.remove_app('com.example.AppName');
Description
iOS tests with XCUITest can also use the mobile: removeApp method.
Get App Strings
Java:Map<String, String> appStrings = driver.getAppStringMap("en", "/path/to/file");
Python:appStrings = self.driver.app_strings("en", "/path/to/file")
End Test Coverage
Get test coverage data
Java:driver.endTestCoverage("Intent", "/path");
Python:self.driver.end_test_coverage("Intent", "/path")
Get Clipboard
Get the content of the system clipboard
Java:
driver.getClipboard(ClipboardContentType.PLAINTEXT); // get plaintext
driver.getClipboardText();
Python:
self.driver.get_clipboard()
self.driver.get_clipboard_text()
Set Clipboard
Set the content of the system clipboard
Java:
// base64Content is Base64-encoded content
driver.setClipboard("label", ClipboardContentType.PLAINTEXT, base64Content);
driver.setClipboardText("happy testing");
Python:
self.driver.set_clipboard('happy testing')
self.driver.set_clipboard_text('happy testing')
Emulate power state
Emulate power state change on the connected emulator.
Java:driver.setPowerAC(PowerACState.OFF);
Python:# Not supported
Emulate power capacity
Emulate power capacity change on the connected emulator.
Java:driver.setPowerCapacity(100);
Python:# Not supported
Push File
Place a file onto the device in a particular place
Java:driver.pushFile("/path/to/device/foo.bar", new File("/Users/johndoe/files/foo.bar"));
Python:self.driver.push_file('/path/to/device/foo.bar', 'QXJlIHlvdXIgYmVlcnMgb2theT8=');
Pull File
Retrieve a file from the device's file system
Java:byte[] fileBase64 = driver.pullFile("/path/to/device/foo.bar");
Python:file_base64 = self.driver.pull_file('/path/to/device/foo.bar');
Pull Folder
Retrieve a folder from the device's file system
Java:byte[] folder = driver.pullFolder("/path/to/device/foo.bar");
Python:folder_base64 = self.driver.pull_folder('/path/to/device/foo.bar');
Shake
Perform a shake action on the device
Java:driver.shake();
Python:self.driver.shake();
Lock
Lock the device
Java:driver.lockDevice();
Python:self.driver.lock();
Unlock
Unlock the device
Java:
driver.lockDevice();
driver.unlockDevice();
Python:
self.driver.lock();
self.driver.unlock();
Is Device Locked
Check whether the device is locked or not
Java:boolean isLocked = driver.isDeviceLocked();
Python:# Not supported
Rotate
Rotate the device in three dimensions
Java:driver.rotate(new DeviceRotation(10, 10, 10));
Python:# Not supported
Press Key Code
Press a particular key on the device
Java:driver.pressKeyCode(AndroidKeyCode.SPACE, AndroidKeyMetastate.META_SHIFT_ON);
Python:self.driver.press_keycode(10);
Long Press Key Code
Press and hold a particular key code on the device
Java:driver.longPressKeyCode(AndroidKeyCode.HOME);
Python:self.driver.long_press_keycode(10);
Hide Keyboard
Hide soft keyboard
Java:driver.hideKeyboard();
Python:self.driver.hide_keyboard()
Is Keyboard Shown
Whether or not the soft keyboard is shown
Java:boolean isKeyboardShown = driver.isKeyboardShown();
Python:# Not supported
Toggle Airplane Mode
Toggle airplane mode on device
Java:driver.toggleAirplaneMode();
Python:# Not supported
Toggle Data
Switch the state of data service
Java:driver.toggleData();
Python:# Not supported
Toggle WiFi
Switch the state of the wifi service
Java:driver.toggleWifi();
Python:# Not supported
Toggle Location Services
Switch the state of the location service
Java:driver.toggleLocationServices();
Python:self.driver.toggle_location_services();
Send SMS
Simulate an SMS message (Emulator only)
Java:driver.sendSMS("555-123-4567", "Hey lol");
Python:# Not supported
GSM Call
Make GSM call (Emulator only)
Java:driver.makeGsmCall("5551234567", GsmCallActions.CALL);
Python:# Not supported
GSM Signal
Set GSM signal strength (Emulator only)
Java:driver.setGsmSignalStrength(GsmSignalStrength.GOOD);
Python:# Not supported
GSM Voice
Set GSM voice state (Emulator only)
Java:driver.setGsmVoice(GsmVoiceState.HOME);
Python:# Not supported
Get Performance Data
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery
Java:List<List> performanceData = driver.getPerformanceData("my.app.package", "cpuinfo", 5);
Python:# Not supported
Get Performance Data Types
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery
Java:List performanceTypes = driver.getSupportedPerformanceDataTypes();
Python:# Not supported
Start Recording Screen
Java:
driver.startRecordingScreen();
driver.startRecordingScreen(new BaseStartScreenRecordingOptions(....));
Python:
self.driver.start_recording_screen()
Stop Recording Screen
Java:
driver.stopRecordingScreen();
driver.stopRecordingScreen(new BaseStopScreenRecordingOptions(....));
Python:
self.driver.stop_recording_screen()
Perform Touch ID
Simulate a touch id event (iOS Simulator only)
Java:
driver.performTouchID(false); // Simulates a failed touch
driver.performTouchID(true); // Simulates a passing touch
Python:
self.driver.touch_id(false); # Simulates a failed touch
self.driver.touch_id(true); # Simulates a passing touch
Toggle Touch ID Enrollment
Toggle the simulator being enrolled to accept touchId (iOS Simulator only)
Java:driver.toggleTouchIDEnrollment(true);
Python:self.driver.toggle_touch_id_enrollment()
Open Notifications
Open Android notifications (Emulator only)
Java:driver.openNotifications();
Python:self.driver.open_notifications();
Get System Bars
Retrieve visibility and bounds information of the status and navigation bars
Java:Map<String, String> systemBars = driver.getSystemBars();
Python:# Not supported
Get System Time
Get the time on the device
Java:String time = driver.getDeviceTime();
Python:time = self.driver.device_time()
Finger print
Authenticate users by using their finger print scans on supported emulators.
Java:driver.fingerPrint(1);
Python:self.driver.finger_print(1)
Appnium-API-Dvice的更多相关文章
- 手机用appnium,web自动化用eclips+webdriver2
手机用appnium,web自动化用eclips+webdriver2 吴建清 pycharm 1.安装环境2.pycharm类似eclipse,写脚本,运行脚本3.uiautomatorviewer ...
- (转)MitmProxy+APPnium安装使用
MitmProxy+APPnium安装使用 2019年08月19日 11:09:48 jiageibuuuyi 阅读数 61更多 分类专栏: python学习笔记 版权声明:本文为博主原创文章,遵 ...
- 干货来袭-整套完整安全的API接口解决方案
在各种手机APP泛滥的现在,背后都有同样泛滥的API接口在支撑,其中鱼龙混杂,直接裸奔的WEB API大量存在,安全性令人堪优 在以前WEB API概念没有很普及的时候,都采用自已定义的接口和结构,对 ...
- 12306官方火车票Api接口
2017,现在已进入春运期间,真的是一票难求,深有体会.各种购票抢票软件应运而生,也有购买加速包提高抢票几率,可以理解为变相的黄牛.对于技术人员,虽然写一个抢票软件还是比较难的,但是还是简单看看123 ...
- 几个有趣的WEB设备API(二)
浏览器和设备之间还有很多有趣的接口, 1.屏幕朝向接口 浏览器有两种方法来监听屏幕朝向,看是横屏还是竖屏. (1)使用css媒体查询的方法 /* 竖屏 */ @media screen and (or ...
- html5 canvas常用api总结(三)--图像变换API
canvas的图像变换api,可以帮助我们更加方便的绘画出一些酷炫的效果,也可以用来制作动画.接下来将总结一下canvas的变换方法,文末有一个例子来更加深刻的了解和利用这几个api. 1.画布旋转a ...
- JavaScript 对数据处理的5个API
JavaScript对数据处理包括向上取整.向下取整.四舍五入.固定精度和固定长度5种方式,分别对应ceil,floor,round,toFixed,toPrecision等5个API,本文将对这5个 ...
- ES5对Array增强的9个API
为了更方便的对Array进行操作,ES5规范在Array的原型上新增了9个方法,分别是forEach.filter.map.reduce.reduceRight.some.every.indexOf ...
- javascript的api设计原则
前言 本篇博文来自一次公司内部的前端分享,从多个方面讨论了在设计接口时遵循的原则,总共包含了七个大块.系卤煮自己总结的一些经验和教训.本篇博文同时也参考了其他一些文章,相关地址会在后面贴出来.很难做到 ...
- 一百元的智能家居——Asp.Net Mvc Api+讯飞语音+Android+Arduino
大半夜的,先说些废话提提神 如今智能家居已经不再停留在概念阶段,高大上的科技公司都已经推出了自己的部分或全套的智能家居解决方案,不过就目前的现状而言,大多还停留在展厅阶段,还没有广泛的推广起来,有人说 ...
随机推荐
- Neutron Vlan Network 学习
vlan network 是带 tag 的网络,是实际应用最广泛的网络类型. 下图是 vlan100 网络的示例. 1. 三个 instance 通过 TAP 设备连接到名为 brqXXXX ...
- myeclipse新建javaweb项目,并部署到tomcat
myeclipse使用的版本: 新建web项目: File-->New-->Web Project,输入项目名称,选择J2EE规范. 完成后: JRE System Library是只要做 ...
- Colorful Bricks CodeForces - 1081C ( 组合数学 或 DP )
On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in t ...
- Ubuntu18.04LTS安装Nvidia显卡
笔者在为Ubuntu18.04LTS安装Nvidia显卡驱动之前,早就听说了一系列关于由于Nvidia驱动引起的疑难杂症.选择高质量的教程并保持足够的耐心,就能解 决这些问题.很重要的一点,不要怕把电 ...
- Linux centos 推拉、共享、监控的设置的分享
新建四台虚拟机 打开第一台连接shell更改主机名.网卡 backup 1.主机名网卡配置 [root@jytcentos7.6 ~]# hostnamectl set-hostname backup ...
- SpringCloud---网关概念、Zuul项目搭建(六)
SpringCloud---网关概念.Zuul项目搭建(六) 一.网关概念 1.什么是路由网关 网关是系统的唯一对外的入口,介于客户端和服务器端之间的中间层,处理非业务功能 提供路由请求.鉴权.监控. ...
- python监控机器(第1版)
# coding:utf-8 import configparser import logging import os import psutil import ctypes import platf ...
- MySQL 的数据目录
MySQL里面有4个数据库是属于MySQL自带的系统数据库: mysql 这个数据库贼核心,它存储了MySQL的用户账户和权限信息,一些存储过程.事件的定义信息,一些运行过程中产生的日志信息,一些帮助 ...
- docker 笔记
批量删除Docker中已经停止的容器[转] 方法一: #显示所有的容器,过滤出Exited状态的容器,取出这些容器的ID, sudo docker ps -a|grep Exited|awk '{p ...
- Oracle表之间关联更新
经常会遇到一个表需要根据另一个表数据来更新数据,总结了核心的sql脚本命令如下: A表如下x y--------------ka dakb dbkc ...