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

上海网站建设排行蓝盟it外包

上海网站建设排行,蓝盟it外包,个人网站创建与管理,北京房产网北京二手房代码示例 下面的代码示例将讲解如何使用Ranorex API来编写代码模块,或者是使用用户代码来扩展录制的模块。 在代码中使用对象库 使用对象库等待UI元素 建立Adapter来访问更多的属性和方法 为对象库元素建立一组Adapter 使用Validate类 强制一个测试用例失败 设置aut…

代码示例
下面的代码示例将讲解如何使用Ranorex API来编写代码模块,或者是使用用户代码来扩展录制的模块。
在代码中使用对象库
使用对象库等待UI元素
建立Adapter来访问更多的属性和方法
为对象库元素建立一组Adapter
使用Validate类
强制一个测试用例失败
设置automation speed
访问测试用例和测试簇的上下文
高级代码示例
如果做基于图像的自动化
如何查找和比较图像
处理意外的对话框

在代码中使用对象库

C#
[TestModule(“D451F1D1-C347-4B58-939F-F6187642EB56”, ModuleType.UserCode, 1)]
public class UsingRepository : ITestModule
{
// Repository object to access UI elements 用来访问UI元素的对象库对象
MyFirstTestProjectRepository repo = MyFirstTestProjectRepository.Instance;
/// <summary>
/// Constructs a new instance.  创建一个新实例
/// </summary>
public UsingRepository()
{
// Do not delete – a parameterless constructor is required! 不要删,需要无参构造器
}
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
// Using Ranorex.Form adapter represented by ‘MyApp’  用Ranorex.Form adapter来表示MyApp
// ‘MyApp’ is used as a folder within the repository;  MyApp是对象库中的文件夹
// the ‘Self’ property returns an object of type Ranorex.Form self用来返回对象
// Activates application 激活应用
repo.MyApp.Self.Activate();
// Log ‘Active’ state 记录状态
Report.Info(repo.MyApp.Self.Active.ToString());
// Maximize, Minimize and Restore 最大化,最小化,复原大小
repo.MyApp.Self.Maximize();
repo.MyApp.Self.Minimize();
repo.MyApp.Self.Restore();
// Closes application 关闭应用
repo.MyApp.Self.Close();
// Using Ranorex.Button adapter represented by ‘ButtonAdd’
// Read and log value of ‘Text’ attribute
Report.Info(repo.MyApp.Buttons.ButtonAdd.Text);
// Press button 按下按钮
repo.MyApp.Buttons.ButtonAdd.Press();
// Read and log value of ‘Enabled’ attribute 读取并记录属性
Report.Info(repo.MyApp.Buttons.ButtonAdd.Enabled.ToString());
// Using Ranorex.RadioButton adapter
// represented by ‘GenderOption’
// Select radio button 选择radio button
repo.MyApp.GenderOption.Select();
// Accessing listitems of Ranorex.List adapter
// represented by ‘CategoryList’
IList<ranorex.listitem> listItems = repo.MyApp.CategoryList.Items;
foreach ( Ranorex.ListItem item in listItems )
{
Report.Info(item.Text + ” is member of CategoryList”);
}
// Using Ranorex.MenuItem to open ‘File’ menu
repo.MyApp.MenuItemFile.Select();
// Selecting sub menu item ‘Connect’
repo.FileMenu.Connect.Select();
// Read and log ‘Enabled’ state of menu item ‘Connect’
Report.Info(repo.FileMenu.Connect.Enabled.ToString());
}
}
VB.NET
Public Class UsingRepository
Implements ITestModule
‘ Repository object to access UI elements
Private repo As MyFirstTestProjectRepository = MyFirstTestProjectRepository.Instance
”’ <summary>
”’ Constructs a new instance.
”’ </summary>
‘ Do not delete – a parameterless constructor is required!
Public Sub New()
End Sub
”’ <summary>
”’ Performs the playback of actions in this module.
”’ </summary>
”’ <remarks>You should not call this method directly, instead pass the module
”’ instance to the <see cref=”TestModuleRunner.Run(ITestModule)”> method
”’ that will in turn invoke this method.</see></remarks>
Private Sub ITestModule_Run() Implements ITestModule.Run
Mouse.DefaultMoveTime = 300
Keyboard.DefaultKeyPressTime = 100
Delay.SpeedFactor = 1.0
‘ Using Ranorex.Form adapter represented by ‘MyApp’
‘ ‘MyApp’ is used as a folder within the repository;
‘ the ‘Self’ property returns a Ranorex.Form object
‘ Activates application
repo.MyApp.Self.Activate()
‘ Log ‘Active’ state
Report.Info(repo.MyApp.Self.Active.ToString())
‘ Maximize, Minimize and Restore
repo.MyApp.Self.Maximize()
repo.MyApp.Self.Minimize()
repo.MyApp.Self.Restore()
‘ Closes application
repo.MyApp.Self.Close()
‘ Using Ranorex.Button adapter represented by ButtonAdd’
‘ Read and log value of ‘Text’ attribute
Report.Info(repo.MyApp.Buttons.ButtonAdd.Text)
‘ Press button
repo.MyApp.Buttons.ButtonAdd.Press()
‘ Read and log value of ‘Enabled’ attribute
Report.Info(repo.MyApp.Buttons.ButtonAdd.Enabled.ToString())
‘ Using Ranorex.RadioButton adapter
‘ represented by ‘GenderOption’
‘ Select radio button
repo.MyApp.GenderOption.[Select]()
‘ Accessing listitems of Ranorex.List adapter
‘ represented by ‘CategoryList’
Dim listItems As IList(Of Ranorex.ListItem) = repo.MyApp.CategoryList.Items
For Each item As Ranorex.ListItem In listItems
Report.Info(item.Text & ” is member of CategoryList”)
Next
‘ Using Ranorex.MenuItem to open ‘File’ menu
repo.MyApp.MenuItemFile.[Select]()
‘ Selecting sub menu item ‘Connect’
repo.FileMenu.Connect.[Select]()
‘ Read and log ‘Enabled’ state of menu item ‘Connect’
Report.Info(repo.FileMenu.Connect.Enabled.ToString())
End Sub
End Class
 

http://www.yayakq.cn/news/600586/

相关文章:

  • 可以登录国外网站吗wordpress动态导航
  • 一般网站的宽度是多少像素项目概述
  • 网站建设完成后交付方式网站建设职能
  • 网站小视频怎么做代理个人怎么做动漫短视频网站
  • discu论坛网站模板建设电商网站的总结
  • 网站建设忄金手指专业东莞网络推广外包
  • 百度不收录新网站服务器域名ip网址大全
  • 上海平台网站建设公司排名友情链接格式
  • 企业 办公 网站模板下载种子搜索神器
  • 滑县网站建设login to view all v2.0 wordpress
  • 如何查询网站开发商网站改版 更换域名
  • 高端设计网站平台防恶意竞价点击软件
  • 公司网站 模板优化seo培训班
  • 最有效的网站推广方法兰州手机网站制作
  • 网站开发的pc或移动端模型评测网站怎么做
  • 个人可以做网站推广想做跨境电商怎么入门
  • html创建站点的步骤租用网站服务器价格
  • 南京房地产网站建设电玩网站
  • 服务器搭建网站跑不满宽带吉林市百姓网免费发布信息网
  • 建设网站网站建设公司做网站不难吧
  • 个性flash网站wordpress调用产品图片
  • 网站制作公司费用制作网站哪家专业
  • 蓟县网站建设公司佛山免费网站建站模板
  • 深圳优化网站兰州互联网公司
  • 软件技术有学做网站吗网页qq直接登陆
  • 做网站必须会去掉自豪的wordpress
  • 网站推广公司兴田德润电话多少网站国际互联网备案号
  • 网站建设的人员预期怎么用php自己做网站
  • 网站开发工程师岗位职责说明书凡科建站代理商登录
  • 网站挂标 怎么做南昌网站建设渠道