QTP基本使用——associate actions

用实例来说话

E.g 现在有一个登陆框 , 点击button “Help”查询登陆密码, 确定后输入账号密码 , 然后登陆 系统,最后关闭

其一: Check the Help about this system.

1) Dialog("Login").WinButton("Help").Click // 点击Dialog “Login”上面的 WinButton "Help"
2) If  Dialog("Login").Dialog("Flight Reservations").Exist Then  //如果Dialog "Flight Reservations"存在, 则执行下面的操作
      Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click  //click the button "确定"
    End If

 

其二: put in the agent name and password, then close the window.

3) Dialog("Login").WinEdit("Agent Name:").Set "mercury"  //Agent name is set as "mercury"
4) Dialog("Login").WinEdit("Password:").SetSecure "4b892adbc75260f617acbe3e950f7551b440f709" //set the password which is encrypted.
5) Dialog("Login").WinButton("OK").Click //Click the button "OK"
6) Window("Flight Reservation").Close  //Close the window "Flight Reservation"

 

PS: 可以将其一分离成为通用的action, 那么在调用它的时候就需要进行关联

First : create new action(action_help)

Step 1: Insert -> Call to new action. Input action_help.

Step 2: Click with RSK and select Action properties. Then select "Reusable action".

 

Second : associate the action

Step 1: Save all the actions. Resources -> Object Repository -> File -> Export Local Objects.

Step 2: Set the association. Resources-> Associate Repositories -> Add repository.

 

Now set the  available actions and associated actions

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值