专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Flex

flex4.0的spark控件不能被qtp10.00的对象查看器识别解决思路

发布时间:2011-06-27 20:47:19 文章来源:www.iduyao.cn 采编人员:星星草
flex4.0的spark控件不能被qtp10.00的对象查看器识别
各位大侠:
  我刚才qtp做flex的自动化测试,使用的flash builder是4.0版本,qtp是10.00,对应的flex脚本为如下:
  <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="actionScriptFunction()">
<fx:Declarations>

</fx:Declarations>

<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;

public function actionScriptFunction():void
{
init()

myLoader.source = FlexGlobals.topLevelApplication.parameters.automationswfurl;
}

private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}

private function init():void
{
myLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}

protected function button1_clickHandler(event:MouseEvent):void 

// TODO Auto-generated method stub 
label1.text = textInput1.text ; 

]]>
</fx:Script>

<mx:SWFLoader id="myLoader" width="100%" height="100%" preinitialize="myLoader.loaderContext = new LoaderContext(false, ApplicationDomain.currentDomain)" >
</mx:SWFLoader>

<mx:Button x="149" y="190" label="3Button" id="button1" click="button1_clickHandler(event)"/> 
<s:Button x="249" y="290" label="4Button" id="button2" click="button1_clickHandler(event)"/>
<mx:Label x="149" y="249" text="" id="label1"/> 
<mx:TextInput x="149" y="130" id="textInput1"/>
</s:Application>

运行后不能用qtp的对象查看器识别出flexbutton或者是sparkbutton控件


------解决方案--------------------
使用qtp必须要:
安装qtp中支持flex的插件,安装包在flexbuilder中有;
编译你的app时必须加入qtp相关的4,5个swc,具体网上查查吧,懒得粘贴
自定义组件(例如继承自UIComponent的)必须写qtp能识别的自动回放类,否则找不到(比较复杂);

有了上面几项,基本上就能识别了,但还有写特殊情况会导致无法识别,可能是bug,需要避免的,这个需要你测试中慢慢去积累,就我所知道的至少有4,5种写法会导致某些控件无法被识别,必须要换代码去绕过
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: