gpt4 book ai didi

qtp - QTP 11.0 中的 Web 可扩展性插件故障排除

转载 作者:行者123 更新时间:2023-12-04 18:29:08 27 4
gpt4 key购买 nike

我正在尝试使用 QTP 11.0 Web 可扩展性插件让自定义 Web 元素类型显示在“对象标识”下。

add-in manager showing gwt and hidden

如问题末尾所示,我的扩展程序中有四个文件。我的问题是没有任何对象显示在 Object Identification 窗口中。我想我可能做错了什么,所以我加载了 SDK 附带的 GWT 示例,但它在对象标识中也没有显示任何内容!

QTP 是否保留有关我可能遇到的错误类型的日志或任何类型的调试信息,或者它是否按预期工作并且这些自定义对象甚至应该显示在对象识别窗口?如果是,为什么?

object identification window showing nothing

$INSTALLDIR\dat\Extensibility\Web\HiddenTestObjects.xml

<?xml version="1.0" encoding="UTF-8"?>
<TypeInformation Load="true" AddinName="Web" PackageName="Hidden" DevelopmentMode="true" priority="1">
<ClassInfo Name="Hidden" BaseClassInfoName="WebElement" GenericTypeID="object" DefaultOperationName="Set" FilterLevel="0">
<Description>Input field of type="hidden".</Description>
<TypeInfo>
<Operation ExposureLevel="CommonUsed" Name="Set" PropertyType="Method">
<Description>Sets the content of the value attribute.</Description>
<Documentation><![CDATA[Enter %a1 in the %l hidden field.]]></Documentation>
<!-- The text to enter in the box. If this argument is not provided, the box is cleared. -->
<Argument Name="text" IsMandatory="false" Direction="In">
<Type VariantType="String"/>
</Argument>
</Operation>
</TypeInfo>
<IdentificationProperties>
<IdentificationProperty ForDefaultVerification="true" ForVerification="true" ForDescription="true" Name="value"/>
<IdentificationProperty ForDefaultVerification="false" ForVerification="false" ForDescription="true" Name="html tag" ForOptionalSmartID="true" OptionalSmartIDPropertyValue="1"/>
<IdentificationProperty Name="html id" ForDefaultVerification="false" ForVerification="false" ForDescription="false"/>
<IdentificationProperty Name="innerhtml" ForDefaultVerification="false" ForVerification="false" ForDescription="false"/>
<IdentificationProperty Name="innertext" ForDefaultVerification="false" ForVerification="false" ForDescription="false" ForOptionalSmartID="true" OptionalSmartIDPropertyValue="2"/>
<IdentificationProperty Name="outerhtml" ForDefaultVerification="false" ForVerification="false" ForDescription="false"/>
<IdentificationProperty Name="outertext" ForDefaultVerification="false" ForVerification="false" ForDescription="false"/>
</IdentificationProperties>
</ClassInfo>
</TypeInformation>

$INSTALLDIR\dat\Extensibility\Web\Toolkits\Hidden\Hidden.xml

<?xml version="1.0" encoding="UTF-8"?>
<Controls xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Settings>
<Variable name="common_file" value="HiddenCommon.js"/>
</Settings>
<JSLibrariesToInject>
<JSLibrary path="INSTALLDIR\bin\JSFiles\jQuery-1.3.2.js" />
<JSLibrary path="INSTALLDIR\bin\JSFiles\jQuery.simulate.js" />
</JSLibrariesToInject>
<Control TestObjectClass="Hidden">
<Settings>
<Variable name="default_imp_file" value="Hidden.js"/>
</Settings>
<Identification>
<Browser name="*">
<HTMLTags>
<Tag name="input"/>
</HTMLTags>
<Conditions type="IdentifyIfPropMatch">
<Condition prop_name="type" expected_value="hidden" is_reg_exp="false" equal="true"/>
</Conditions>
</Browser>
</Identification>
<Record>
<EventListening use_default_event_handling_for_children="true" use_default_event_handling="true" type="javascript" function="ListenToEvents"/>
</Record>
<Run>
<Methods>
<Method name="Set" function="Set"/>
</Methods>
</Run>
<Filter>
<Spy is_control_spyable="Yes"/>
<Learn learn_children="No" learn_control="Yes"/>
</Filter>
</Control>
</Controls>

$INSTALLDIR\dat\Extensibility\Web\Toolkits\Hidden\Hidden.js

/////////////////////////////////////////////////////////////////////////
// Hidden.js
//
// This file contains the implementation of the support for Hidden input controls.
//
/////////////////////////////////////////////////////////////////////////

var HIDDEN_CATEGORY = 7;

function get_property_value(property) {
if (property == "logical name") {
return "Hidden";
}
if (property == "type") {
return "hidden";
}

if (property == "value") {
return window.$(_elem).value;
}

if (property == "disabled") {
return false;
}
}

function Set(text) {
preventReplayOnDisabledControl("Set");
// NULL or empty text string can be used to clear the text area.
// Convert both to an empty string.
window.$(_elem).value = (text != null? text : "");

var reportParams = new Array(text);
_util.Report(micDone, "Set", toSafeArray(reportParams), "Set the following text:" + text);
return true;
}

function ListenToEvents(elem) {

return true;
}

$INSTALLDIR\dat\Extensibility\Web\Toolkits\Hidden\HiddenCommon.js

/////////////////////////////////////////////////////////////////////////////////
// HiddenCommon.js
//
// This file contains shared JavaScript functions that can be called by functions
// in other JavaScript files in the Hidden toolkit support set.
//
/////////////////////////////////////////////////////////////////////////////////

function HTMLElemArrayToString(HTMLElemArray)
{
var ElemArrayAsString = new Array();
for (var i = 0; i < HTMLElemArray.length; i++)
{
ElemArrayAsString.push(window.$(HTMLElemArray[i]).text());
}
return ElemArrayAsString.join(";");
}

function preventReplayOnDisabledControl(action) {
if (get_property_value("disabled")) {
_util.Report(micFail, action, toSafeArray(new Array()), "Cannot Replay On Disabled Control");
throw "Cannot Replay On Disabled Control";
}
}

function shouldIgnoreEvent(eventObj) {
if (get_property_value("disabled")) {
return true;
}
if (eventObj.button && eventObj.button != QtpConstants.LEFT_BUTTON()) {
return true;
}

return false;
}

最佳答案

QTP 从您的 HiddenTestObjects.xml 文件中获取要在对象识别中使用的属性。在那里您可以指定哪个属性是 ForDescription 和智能识别(查看架构或文档了解更多详细信息)。

QTP 允许通过对象识别对话框在机器对机器的基础上覆盖这些设置会很好,但 AFAIK 的假设是 Web 可扩展性作者最了解应该使用哪些属性。

如果您认为让用户覆盖您在HiddenTestObjects.xml 中规定的对象识别规则很重要,您应该向 HP 提出增强请求。否则,我所知道的唯一方法是指示用户在本地编辑 HiddenTestObjects.xml

关于qtp - QTP 11.0 中的 Web 可扩展性插件故障排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18241075/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com