没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:莫成敏|2019-12-05 11:31:59.820|阅读 388 次
概述:TestComplete是一款自动化功能测试平台。本文描述如何通过附近控件的文本识别没有文本内容的控件。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
TestComplete是一款具有人工智能的自动UI测试工具,利用自动化测试工具和人工智能支持的混合对象识别引擎,轻松检测和测试每个桌面,Web和移动应用程序。本文介绍了如何通过附近控件的文本识别没有文本内容的控件。
在测试中,您可以使用光学字符识别(OCR)引擎通过其文本内容来标识经过测试的UI元素。但是,您可能会遇到这样的情况,您需要在UI元素上模拟用户操作,该UI元素没有任何可用来识别它的文本内容。例如,申请表上的空白文本框或备注字段。
在这种情况下,您可以通过其旁边的文本来标识此类UI元素。例如,您可以通过标签来标识文本框:
为此,您需要获取经过测试的UI元素旁边的文本块,指定目标屏幕区域并在其上模拟用户操作。
在关键字测试中
1、将OCR操作操作添加到测试中。
2、选择包含所需的UI元素的屏幕对象或屏幕区域。确保选定的对象或区域还包括一个文本片段,您将通过该文本片段标识UI元素。TestComplete将识别所选控件或区域中的所有文本。
3、选择一个文本片段:
4、选择要在您测试的UI元素上模拟的操作:
ClickNextTo ——模拟点击(对于桌面和Web应用程序)。
TouchNextTo ——模拟触摸(用于移动应用程序)。
SendKeys ——模拟键盘输入。
5、指定测试的UI元素相对于所选文本块的位置:
6、指定要模拟用户操作的区域与所选文本块的边框之间的距离:
在脚本中
1、获取包含所需的UI元素的屏幕对象或屏幕区域。确保选定的对象或区域还包括文本片段,您将通过该文本片段来标识UI元素。
2、使用该OCR.Recognize方法识别对象或屏幕区域内的文本。
3、使用Block属性或BlockByText方法获取要用来标识UI元素的文本片段。
4、要模拟用户对UI元素的操作,请调用适当的方法,并指定测试的UI元素相对于文本片段的位置以及它们之间的距离:
ClickNextTo ——模拟点击(对于桌面和Web应用程序)。
TouchNextTo ——模拟触摸(用于移动应用程序)。
SendKeys ——模拟键盘输入。
下面的示例演示如何模拟在其标签识别的文本框中的单击,然后在文本框中键入文本:
JavaScript, JScript
function GetControlByNearbyText() { // Recognize the text of the tested application's main window var wnd = Sys.Process("myApp").Window("Main"); var obj = OCR.Recognize(wnd); // Find the "Customer Name" label var t = obj.BlockByText("Customer Name:"); // Enter "John Smith" in the text box to the right of the found label t.ClickNextTo(toRight, 25); t.SendKeys("John Smith", toRight, 25); … }
Python
def GetControlByNearbyText(): # Recognize the text in the tested application wnd = Sys.Process("myApp").Window("Main") obj = OCR.Recognize(wnd) # Find the "Customer Name" label t = obj.BlockByText("Customer Name:") # Enter the text to the text box to the right of the found label t.ClickNextTo(toRight, 25) t.SendKeys("John Smith", toRight, 25)
VBScript
Sub GetControlByNearbyText ' Recognize the text of the tested application's main window Set wnd = Sys.Process("myApp").Window("Main") Set obj = OCR.Recognize(wnd) ' Find the "Customer Name" label Set t = obj.BlockByText("Customer Name:") ' Enter "John Smith" in the text box to the right of the found label Call t.ClickNextTo(toRight, 25) Call t.SendKeys("John Smith", toRight, 25) … End Sub
DelphiScript
procedure GetControlByNearbyText(); var wnd, obj, t; begin // Recognize the text of the tested application's main window wnd := Sys.Process('myApp').Window('Main'); obj := OCR.Recognize(wnd); // Find the 'Customer Name' label t := obj.BlockByText('Customer Name:'); // Enter "John Smith" in the text box to the right of the found label t.ClickNextTo(toRight, 25); t.SendKeys('John Smith', toRight, 25); … end;
C++Script, C#Script
function GetControlByNearbyText() { // Recognize the text of the tested application's main window var wnd = Sys["Process"]("myApp")["Window"]("Main"); var obj = OCR["Recognize"](wnd); // Find the "Customer Name" label var t = obj["BlockByText"]("Customer Name:"); // Enter "John Smith" in the text box to the right of the found label t["ClickNextTo"](toRight, 25); t["SendKeys"]("John Smith", toRight, 25); … }
下面的示例演示如何模拟在移动应用程序中由其标签识别的文本框上的触摸,然后在文本框中键入文本:
JavaScript, JScript
function GetControlByNearbyText_Mobile() { // Recognize the text of the tested application's main window var p = Mobile.Device("MyDevice").Process("smartbear.tctests.myapp").RootLayout("").Layout("layoutTop").WebView("webview").Page("*test*.html"); var obj = OCR.Recognize(p); // Find the "Customer Name" label var t = obj.BlockByText("Customer Name:"); // Enter "John Smith" in the text box to the right of the found label t.TouchNextTo(toRight, 25); t.SendKeys("John Smith", toRight, 25); … }
Python
def GetControlByNearbyText_Mobile(): # Recognize the text in the tested application p = Mobile.Device("MyDevice").Process("smartbear.tctests.myapp").RootLayout("").Layout("layoutTop").WebView("webview").Page("*test*.html") obj = OCR.Recognize(p) # Find the "Customer Name" label t = obj.BlockByText("Customer Name:") # Enter the text to the text box to the right of the found label t.TouchNextTo(toRight, 25) t.SendKeys("John Smith", toRight, 25)
VBScript
Sub GetControlByNearbyText_Mobile() ' Recognize the text of the tested application's main window Set p = Mobile.Device("MyDevice").Process("smartbear.tctests.myapp").RootLayout("").Layout("layoutTop").WebView("webview").Page("*test*.html") Set obj = OCR.Recognize(p) ' Find the "Customer Name" label Set t = obj.BlockByText("Customer Name:") ' Enter "John Smith" in the text box to the right of the found label Call t.TouchNextTo(toRight, 25) Call t.SendKeys("John Smith", toRight, 25) … End Sub
DelphiScript
procedure GetControlByNearbyText_Mobile(); var p, obj, t; begin // Recognize the text of the tested application's main window p := Mobile.Device('MyDevice').Process('smartbear.tctests.myapp').RootLayout('').Layout('layoutTop').WebView('webview').Page('*test*.html'); obj := OCR.Recognize(p); // Find the "Customer Name" label t := obj.BlockByText('Customer Name:'); // Enter "John Smith" in the text box to the right of the found label t.TouchNextTo(toRight, 25); t.SendKeys('John Smith', toRight, 25); … end;
C++Script, C#Script
function GetControlByNearbyText_Mobile() { // Recognize the text of the tested application's main window var p = Mobile["Device"]("MyDevice")["Process"]("smartbear.tctests.myapp")["RootLayout"]("")["Layout"]("layoutTop")["WebView"]("webview")["Page"]("*test*.html"); var obj = OCR["Recognize"](p); // Find the "Customer Name" label var t = obj["BlockByText"]("Customer Name:"); // Enter "John Smith" in the text box to the right of the found label t["TouchNextTo"](toRight, 25); t["SendKeys"]("John Smith", toRight, 25); … }
相关内容推荐:
想要购买TestComplete正版授权,或了解更多产品信息请点击
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@wqylolg.cn
文章转载自:无论是零售、物流还是医疗保健,旋转条形码图像的功能都能增强不同应用的灵活性和适应性。使用Aspose.BarCode for Java,您可以轻松旋转条形码图像,确保它们无缝融入应用程序的设计和布局。
借助Aspose.Slides for Java,开发人员可以轻松编辑 PowerPoint 幻灯片(包括表格),以增强演示文稿的效果。
VMProtect 是保护程序代码免遭分析与破解的利器,但很多开发者在实现注册机制时犯了关键性错误,使得再强大的加壳工具也难以阻挡黑客破解。本文将从注册逻辑设计、密钥验证方式、注册状态存储等多个角度,系统拆解常见误区,并结合 VMProtect 的虚拟化和加密策略,提供构建高强度注册保护的实战方案。
在本文中,我们将探讨如何在FastReport .NET中配置与 Apache Ignite 的连接。您将学习通过代码和报表设计器连接插件的必要步骤。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@wqylolg.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢