qtp12录制脚本后回放出现问题,web前端登录的脚本
用qtp12 录制登录脚本之后回放,回放的时候自动填写了用户名,但是提交的时候却提示用户名为空。录制的是自己公司的web前端,听开发说他们用的swt框架,他用火狐浏览器中的开发者帮我看了一下,
发现,脚本填写的用户名没有传递参数到服务器,但是手工填写的就可以传递参数到服务端。
我用syp对象识别器识别了系统中好几个文本框,属性如下
"Class Name:=WebEdit",
"abs_x:=626",
"abs_y:=345",
"class:=",
"default value:=",
"disabled:=0",
"height:=18",
"html id:=",
"html tag:=INPUT",
"innerhtml:=",
"innertext:=",
"kind:=singleline",
"max length:=10",
"name:=WebEdit",
"outerhtml:=<input type=""text"" style=""position: absolute; padding: 0px 1px 0px 0px; margin: 0px; border: 0px none; background: none repeat scroll 0% 0% transparent; overflow: hidden; outline: medium none; resize: none; -moz-appearance: none; font-family: Verdana,""Lucida Sans"",Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; color: rgb\(74, 74, 74\); width: 176px; top: 1px;"" autocomplete=""off"" maxlength=""10"">",
<input type="text" style="position: absolute; padding: 0px 1px 0px 0px; margin: 0px; border: 0px none; background: none repeat scroll 0% 0% transparent; overflow: hidden; outline: medium none; resize: none; -moz-appearance: none; font-family: Verdana,"Lucida Sans",Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; color: rgb(74, 74, 74); width: 176px; top: 1px;" autocomplete="off" maxlength="10">
"outertext:=",
"pattern:=",
"placeholder:=",
"readonly:=0",
"required:=False",
"rows:=0",
"title:=",
"type:=text",
"value:=",
"visible:=True",
"width:=176",
"width in characters:=20",
"x:=626",
"xpath:=",
"y:=255"
"Class Name:=WebEdit",
"abs_x:=626",
"abs_y:=389",
"class:=",
"default value:=",
"disabled:=0",
"height:=18",
"html id:=",
"html tag:=INPUT",
"innerhtml:=",
"innertext:=",
"kind:=singleline",
"max length:=6",
"name:=WebEdit",
"outerhtml:=<input type=""text"" style=""position: absolute; padding: 0px 1px 0px 0px; margin: 0px; border: 0px none; background: none repeat scroll 0% 0% transparent; overflow: hidden; outline: medium none; resize: none; -moz-appearance: none; font-family: Verdana,""Lucida Sans"",Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; color: rgb\(74, 74, 74\); width: 176px; top: 1px;"" autocomplete=""off"" maxlength=""6"">",
"outertext:=",
"pattern:=",
"placeholder:=",
"readonly:=0",
"required:=False",
"rows:=0",
"title:=",
"type:=text",
"value:=",
"visible:=True",
"width:=176",
"width in characters:=20",
"x:=626",
"xpath:=",
"y:=299"
"Class Name:=WebEdit",
"abs_x:=626",
"abs_y:=433",
"class:=",
"default value:=",
"disabled:=0",
"height:=18",
"html id:=",
"html tag:=INPUT",
"innerhtml:=",
"innertext:=",
"kind:=singleline",
"max length:=6",
"name:=WebEdit",
"outerhtml:=<input type=""password"" style=""position: absolute; padding: 0px 1px 0px 0px; margin: 0px; border: 0px none; background: none repeat scroll 0% 0% transparent; overflow: hidden; outline: medium none; resize: none; -moz-appearance: none; font-family: Verdana,""Lucida Sans"",Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; color: rgb\(74, 74, 74\); width: 176px; top: 1px;"" autocomplete=""off"" maxlength=""6"">",
"outertext:=",
"pattern:=",
"placeholder:=",
"readonly:=0",
"required:=False",
"rows:=0",
"title:=",
"type:=password",
"value:=",
"visible:=True",
"width:=176",
"width in characters:=20",
"x:=626",
"xpath:=",
"y:=343"
"Class Name:=WebEdit",
"abs_x:=626",
"abs_y:=345",
"class:=",
"default value:=",
"disabled:=0",
"height:=18",
"html id:=",
"html tag:=INPUT",
"innerhtml:=",
"innertext:=",
"kind:=singleline",
"max length:=10",
"name:=WebEdit",
"outerhtml:=<input type=""text"" style=""position: absolute; padding: 0px 1px 0px 0px; margin: 0px; border: 0px none; background: none repeat scroll 0% 0% transparent; overflow: hidden; outline: medium none; resize: none; -moz-appearance: none; font-family: Verdana,""Lucida Sans"",Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; color: rgb\(74, 74, 74\); width: 176px; top: 1px;"" autocomplete=""off"" maxlength=""10"">",
"outertext:=",
"pattern:=",
"placeholder:=",
"readonly:=0",
"required:=False",
"rows:=0",
"title:=",
"type:=text",
"value:=",
"visible:=True",
"width:=176",
"width in characters:=20",
"x:=626",
"xpath:=",
"y:=255"
除了红色部分,其他的地方都是一样的,
有人遇到同样的问题么,怎么解决的?求解答。。
这是录制的脚本
Browser("xxxxxxx").Page("xxxxxx").WebEdit("WebEdit").Set "xxxxxx"
Browser("xxxxxx").Page("xxxxxx").WebEdit("xxxxxx").SetSecure "xxxxxx"
Browser("xxxxxx").Page("xxxxxxx").WebElement("登录").Click
补充:qtp在回放的时候没有报错 补充
该控件的特征:
1、用qtp录制脚本回放时,脚本填写的内容不识别,提交时提示为空(控件中有内容)
2、用qtp脚本填写用户名之后,停止运行脚本,手动在文本框后输入内容再将输入内容减去,就不会提示为空
3、其他的文本框都如此,添加同步点或者wait也不管用。 叫开发把这几个东西的ID补上,你再录制一次试下。
或是自己写脚本用描述性编程试试。。。。 支持楼上,先看下对象库里控件的ID是否全。。。如果不用对象库,直接就用描述性编程写。。。 seagull1985 发表于 2016-7-19 13:56
叫开发把这几个东西的ID补上,你再录制一次试下。
或是自己写脚本用描述性编程试试。。。。
(⊙o⊙)… 是什么ID呢 我感觉是控件的问题,用脚本在文本框填写内容后,再用键盘输入字符再把字符减去后就不提示为空,这个控件不支持用type。。 用set又这样 我之前录制用火狐和谷歌都不行,只能IE,你试试换个浏览器 xhh622 发表于 2016-7-20 19:07
我之前录制用火狐和谷歌都不行,只能IE,你试试换个浏览器
我用的qtp12支持火狐浏览器,我们系统不支持ie、所以挺麻烦的 944188518@qq.co 发表于 2016-7-20 19:35
我用的qtp12支持火狐浏览器,我们系统不支持ie、所以挺麻烦的
你在输入用户名步骤加一个同步点,或者加一个等待时间试试 xhh622 发表于 2016-7-21 15:53
你在输入用户名步骤加一个同步点,或者加一个等待时间试试
谢谢、、还是不行啊 Function Sendkeys(str)
Set wshShell = CreateObject("WScript.Shell")
wshShell.Sendkeys str
End Function
模拟键盘的方法试试 莫格利 发表于 2016-7-29 15:30
Function Sendkeys(str)
Set wshShell = CreateObject("WScript.Shell")
wshShell.Sendkeys str
还是不行啊谢谢 :( 我觉得是控件属性的问题不支持type 用set可以赋值但是控件却不识别set填写的东西 lz你的问题解决了没 1094389572 发表于 2016-8-3 14:02
lz你的问题解决了没
木有 怎么感觉51人很少的样子
页:
[1]