登录密码加密,SetSecure不可用

2014-07-01  林珍 

录制登录密码,明文admin123,录制内容为密文,用SetSecure提示出错

'Browser("****").Page("****").WebEdit("name").SetSecure "53b21d78767ae27d4fe0c37ea6fec85d941629764b3f"

错误提示:

Cannot identify the object "sc1050" (of class WebEdit). Verify that this object's properties match an object currently displayed in your application.
Line (6): "Browser("**").Page("***").WebEdit("name").SetSecure "53b21d78767ae27d4fe0c37ea6fec85d941629764b3f"". 
Tip: If the objects in your application have changed, the Maintenance Run Mode can 
help you identify and update your steps and/or the objects in your repository.
用了网友的方法,还是不行:


1 :切换到Expert View的Tab页面,将“SetSecure” 这个函数改成“Set” ,QTP就可以以明文方式处理数据了。

2.:在DataTable中选中需要加密的数据,点击右键,依次选择【Data】--【Encrvnt】项,就可以将明文数据进行加密了。


3. 调用函数去实现加密:函数Crypt.Encrypt(),例如:

     Org_password= "thisisorgpassword"

     E_password= Crypt.Encrypt(Org_password)

发现这几个方法都行不通,只有用object.value直接赋值了

Browser("**").Page("***").WebEdit("name").object.value="admin123"

这里会出现个问题,点登录的时候,密码会清空,所有登录不成功。

最后解决方法:模拟键盘操作,输入密码

Dim wshShell
Set wshShell = CreateObject("Wscript.Shell")
wshShell.sendkeys "{tab}"
wshShell.sendkeys "admin123"

437°/4363 人阅读/1 条评论 发表评论

小窝  2014-07-01

关注


登录 后发表评论