简体   繁体   中英

How to get dialog box text using UFT script?

I am using HP UFT for browser automation in IE browser and here i have one problem ie Validating the Cards,below are the dialog message will display as per scenario and i need to write if condition based on dialog text,for examples

Scenario texts:

  1. Card is valid for registration
  2. Card No is already registered
  3. Card is blocked
  4. Card is not valid for registration.

All the above dialog box message will comes at one point ie click on validate card button and please provide one simple script to get that message dynamically in HP UFT .

My Code for Invalid Card number:

Browser("name:=Customer").Dialog("text:=Message from webpage").WinButton("text:=OK").Click
card_number=Browser("name:=Customer").Page("title:=Customer").WebEdit("name:=customerVo.cardNo").GetROProperty("value")
card_status=Browser("name:=Customer").Dialog("text:=Message from webpage").GetROProperty("value")
If card_number="" Then

Reporter.ReportEvent micWarning,"Verify Card Number","Scanned Card number is already registered/Invalid Card Number"
DataTable.value("card_status","customer_enrollment")=card_status
else
Remaining positive script
DataTable.value("card_status","customer_enrollment")=card_status
End If

IN above code i want to print particular scenario message in excel for each records, as based upon card validation status,please help.

对于由JavaScript的alert创建的对话框, confirmprompt功能应使用Browser(".").GetDialogText方法。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM