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
大半夜的,先说些废话提提神 如今智能家居已经不再停留在概念阶段,高大上的科技公司都已经推出了自己的部分或全套的智能家居解决方案,不过就目前的现状而言,大多还停留在展厅阶段,还没有广泛的推广起来,有人说 ...
随机推荐
- yarn 在Vue框架中的常用命令
初始化项目 yarn add init 安装vue yarn add vue 安装webpack,webpack-dev-server(是一个小型的Node.js Express服务器) yarn a ...
- 一、操作m'y's'ql
一.创建framework框架的控制台默认不支持mysql
- JS获取浏览器地址栏的多个参数值的任意值
getParamValue("id"); //http://localhost:2426/TransactionNotes.aspx?id=100 //返回值是100: // 根据 ...
- Ubuntu 16.04 安装opencv3.4.5/cuda/caffe并使用jni笔记
因操作失误,误卸开发机NVIDIA显卡驱动,先更新操作日志如下: 1>NVIDIA驱动重装 1.卸载系统里的Nvidia残余 sudo apt-get purge nvidia* 2.把显卡驱动 ...
- 使用Excel批量提取文件名
Excel中如何快速选择所有奇数行或偶数行? 方法3:=MOD(ROW(),2) 总结:方法1和方法2的区别主要在ctrl键的使用 轻松将一个文件夹里所有的文件名提取出来,放到Excel表格里 &qu ...
- <TCP/IP原理> (三) 底层网络技术
传输介质 局域网(LAN) 交换(Switching) 广域网(WAN) 连接设备 第三章 底层网络技术 引言 1)Interne不是一种新的网络 建立在底层网络上的网际网 底层网络——“物理网”,网 ...
- win 10 dpi 缩放
win 10 dpi dwm 效果,影响最大的函数有 参考资料:https://blog.csdn.net/chenlycly/article/details/53142098 GetSystemMe ...
- 第三篇--创建.gitignore文件
小知识 · git add -A 提交所有变化 · git add -u 提交被修改(modified)和被删除(deleted)文件,不包括新文件(new) · git add . 提交 ...
- 主成分分析_PCA解释
粘贴自:http://blog.codinglabs.org/articles/pca-tutorial.html 数据的向量表示及降维问题 向量的表示及基变换 协方差矩阵及优化目标 协方差矩阵对角化 ...
- 编写高质量的Python代码系列(四)之元类及属性
元类(metaclass)及动态属性(dynamic attribute)都是很强大的Python特性,然后他们也可能导致及其古怪.及其突然的行为.本节讲解这些机制的常见用法,以确保各位程序员写出来的 ...