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

网站维护中怎么解决/网站建设外包

网站维护中怎么解决,网站建设外包,网站制作的论文,川畅联系 做网站多少钱一、MonkeyRunner APIMonkeyRunner API包含了三个模块在com.android.monkeyruner包中:1、MonkeyRunner一类用于MonkeyRunner程序的实用方法。该类提供了一种将MonkeyRunner连接到设备或仿真器的方法。它还提供了为monkeyrunner程序创建UI以及显示内置帮助的方法2、M…

一、MonkeyRunner API

MonkeyRunner API包含了三个模块在com.android.monkeyruner包中:

1、MonkeyRunner

一类用于MonkeyRunner程序的实用方法。该类提供了一种将MonkeyRunner连接到设备或仿真器的方法。它还提供了为monkeyrunner程序创建UI以及显示内置帮助的方法

2、MonkeyDevice

表示设备或仿真器。这个类提供了安装和卸载包、启动Activity、以及向app发送键盘或触摸事件的方法。您还可以使用该类运行测试包。

3、MonkeyImage

表示屏幕捕获图像。这个类提供了用于捕获屏幕、将位图图像转换为各种格式、比较两个MonkeyImage对象以及将图像写入文件的方法。

二、运行MonkeyRunner

有两种方式可以编写MonkeyRunner用例:

在cmd窗口直接运行monkeyrunner

使用Python编写测试代码,在CMD中执行monkeyrunner test.py运行

60374bff05f348c21fc93672e9c45261.png

a7fd8f6f6c52db1be9bde6e4ed1b2e49.png

三、MonkeyRunner

MonkeyRunner常用方法如下

1、waitForConnect(float timeout, string deviceId)

waitForConnection()方法返回一个MonkeyDevice对象

device = MonkeyRunner.waitForConnection(3,‘127.0.0.1:62001‘)

deviceId可通过adb devices查看

f7796e1201750032932523d4ba59ff6e.png

2、sleep(float seconds)

等待时长

MonkeyRunner.sleep(5)

3、alert(string message, string title, string okTitle)

向运行当前程序的进程显示警报对话框。对话框是模态的,所以程序暂停,直到用户点击对话框的按钮。

MonkeyRunner.alert(‘TestTitle‘, ‘This is the message‘, ‘OK‘)

结果如图:

6e021d6b1a3e16bb5514708644cc6655.png

4、choice(string message, iterable choices, string title)

在运行当前程序的进程中显示一个具有选择列表的对话框。对话框是模态的,所以程序暂停,直到用户点击对话框中的一个按钮。

MonkeyRunner.choice(‘TestChoice‘, [‘choice1‘,‘choice2‘], ‘Title‘)

553c7e529c40d91493d8db3ee0dd5ab6.png

5、input(string message string initialValue, string title, string okTitle, string cancelTitle)

显示一个接受输入并将其返回给程序的对话框。对话框是模态的,所以程序暂停,直到用户点击对话框中的一个按钮。

对话框包含两个按钮,一个显示okTitle值,另一个显示cancelTitle值。如果用户单击OKTITE按钮,则返回输入框的当前值。如果用户单击取消标题按钮,则返回一个空字符串。

MonkeyRunner.input(‘message‘, ‘initialValue‘, ‘title‘, ‘ok‘, ‘cancel‘)

5cc31457a375d76cef610b0468e3c883.png

四、MonkeyDevice

通常情况下,不必创建MonkeyDevice的实例。相反,您使用MonkeyRunner.waitForConnection()从到设备或仿真器的连接创建新对象。

device = MonkeyRunner.waitForConnection(3,‘127.0.0.1:62001‘)

1、常量

Constants

string

Use this with the type argument of

string

Use this with the type argument of

string

Use this with the type argument of

2、常用方法:

press()、touch()、startActivity()、installPackage()、type()、drag()

方法详细如下:

Methods

void

broadcastIntent (string uri, string action, string data, string mimetype, iterable categories dictionary extras, component component, iterable flags)

Broadcasts an Intent to this device, as if the Intent were coming from an application.

void

drag (tuple start, tuple end, float duration, integer steps)

Simulates a drag gesture (touch, hold, and move) on this device‘s screen.

object

getProperty (string key)

Given the name of a system environment variable, returns its value for this device. The available variable names are listed in the detailed description of this method.

object

. The API equivalent of adb shell getprop . This is provided for use by platform developers.

void

Installs the Android application or test package contained in packageFile onto this device. If the application or test package is already installed, it is replaced.

dictionary

instrument (string className, dictionary args)

Runs the specified component under Android instrumentation, and returns the results in a dictionary whose exact format is dictated by the component being run. The component must already be present on this device.

void

press (string name, dictionary type)

Sends the key event specified by type to the key specified by keycode.

void

reboot (string into)

Reboots this device into the bootloader specified by bootloadType.

void

removePackage (string package)

Deletes the specified package from this device, including its data and cache.

object

shell (string cmd)

Executes an adb shell command and returns the result, if any.

void

startActivity (string uri, string action, string data, string mimetype, iterable categories dictionary extras, component component, flags)

Starts an Activity on this device by sending an Intent constructed from the supplied arguments.

Captures the entire screen buffer of this device, yielding a

void

touch (integer x, integer y, integer type)

Sends a touch event specified by type to the screen location specified by x and y.

void

type (string message)

Sends the characters contained in message to this device, as if they had been typed on the device‘s keyboard. This is equivalent to callingmessage using the key event type DOWN_AND_UP.

void

Wakes the screen of this device.

五、MonkeyImage

该类主要用于截图

newimage = MonkeyDevice.takeSnapshot()

newimage.writeToFile(‘E:\\autoTest\\test_02.png‘,‘png‘)

如下是官网给的一个例子

#Imports the monkeyrunner modules used by this program

from com.android.monkeyrunner importMonkeyRunner, MonkeyDevice#Connects to the current device, returning a MonkeyDevice object

device =MonkeyRunner.waitForConnection()#Installs the Android package. Notice that this method returns a boolean, so you can test#to see if the installation worked.

device.installPackage(‘myproject/bin/MyApplication.apk‘)#sets a variable with the package‘s internal name

package = ‘com.example.android.myapplication‘

#sets a variable with the name of an Activity in the package

activity = ‘com.example.android.myapplication.MainActivity‘

#sets the name of the component to start

runComponent = package + ‘/‘ +activity#Runs the component

device.startActivity(component=runComponent)#Presses the Menu button

device.press(‘KEYCODE_MENU‘, MonkeyDevice.DOWN_AND_UP)#Takes a screenshot

result =device.takeSnapshot()#Writes the screenshot to a file

result.writeToFile(‘myproject/shot1.png‘,‘png‘)

原文:https://www.cnblogs.com/fancy0158/p/10068845.html

http://www.lbrq.cn/news/819955.html

相关文章:

  • 杭州网站设计 site/百度指数的主要用户是
  • 学校网站搭建/推广软文模板
  • wordpress快速建站教程视频教程/soso搜索引擎
  • 建设人力资源服务网站工作方案/百度指数数据官网
  • 北京建设注册中心网站首页/seo整站优化服务
  • 如何更改 网站 关键词/网站标题优化排名
  • 网站建设知乎/百度官网入口
  • 荆州网站建设 众火网/b2b国际贸易平台
  • wordpress文章全部随机排/百度seo优化包含哪几项
  • 邯郸哪有做网站的公司/外链seo
  • 昆明双鼎网站制作/重庆森林粤语
  • 网站建设工作方案/seo网站优化推广教程
  • 网站建设管理情况说明/网站设计服务企业
  • 美国做海关数据知名网站/个人对网络营销的看法
  • 做网站1万多/舆情通
  • 莱芜可信赖的网络推广公司/seo优化招商
  • java开发网站开发教程/网站seo分析工具
  • 智慧团建系统官方网站/中国外贸订单网
  • 裤子seo关键词/seo上海培训
  • 重庆网站建设公司/中国十大电商平台有哪些
  • 网站首页设计报价多少/seo网站首页推广
  • 中润建设集团有限公司网站群/友情链接赚钱
  • 哈尔滨seo网站排名/投诉百度最有效的电话
  • 在合肥做网站多少钱/百度软文推广公司
  • 做网站有2个前提条件 一个是网站/宁波正规优化seo公司
  • java开发企业网站开发文档6/临沂seo整站优化厂家
  • 商业广告公司排名/百度关键词优化怎么做
  • 系统网站怎么做的/杭州seo推广优化公司
  • 网站顶部固定怎么做/中国万网域名注册服务内容
  • 西安创意网站建设/深圳网络推广建站
  • 论文阅读:《无约束多目标优化的遗传算法,群体和进化计算》
  • 挖掘录屏宝藏:Screenity 深度解析与使用指南
  • 【智能协同云图库】智能协同云图库第六弹:空间模块开发
  • Ubuntu22.04.5 LTS安装与使用Docker
  • 【音视频学习】四、深入解析视频技术中的YUV数据存储方式:从原理到实践
  • 压测软件JMeter安装配置以及创建桌面快捷方式(详细图解)