Tuesday, January 8, 2019


GetROProperty Method in QTP

GetROProperty method is used to identify an object in an Run time, It retrieves the properties and values where the QTP is recorded also the property is listed in the script. 

Here we can see the few examples that how the Getroproperty is work for real-time applications.
Below scripts will get the entire object properties in a msgbox for the declared unique properties in the scripts. So that we can ensure those object Properties are present in the application.

'www.google.com

Set wsh=Createobject("wscript.shell")
Set olink=Description.Create
olink("micclass").value="Link"
Set olinkcoll=Browser("name:=Google").Page("title:=Google").ChildObjects(olink)
'The script will pass the total number of links present in the message box
msgbox olinkcoll.count
For i=0 to olinkcoll.count -1

lslink=olinkcoll(i).getroproperty("name")
lsurl=olinkcoll(i).getroproperty("text")
wsh.Popup lslink,1,"The link name is"
wsh.Popup lsurl,1,"The url of the link is"
Next

'www.yahoo.com

Set wsh=Createobject("Wscript.Shell")
Set olink=Description.Create
olink("micclass").value="Link"
Set olinkcoll=Browser("name:=Yahoo! India").Page("title:=Yahoo! India").ChildObjects(olink)
'The script will pass the total number of links present in the message box 
msgbox olinkcoll.count
For i=0 to olinkcoll.count-1
lslink=olinkcoll(i).GetROProperty("name")
lsurl=olinkcoll(i).GetRoproperty("Link")
wsh.Popup lslink,1,"The Link name is"
wsh.Popup lsurl,1,"The url of the link is"

'www.rediff.com

Set wsh=CreateObject("Wscript.Shell")
Set olink=Description.Create
olink("micclass").value="name"
Set olinkcoll=Browser("name:=Rediff.com - India, Business, Stock, Sports, Cricket, Entertainment, Bollywood, Music, Video and Breaking news, Rediffmail NG, Shopping").Page("title:=Rediff.com - India, Business, Stock, Sports, Cricket, Entertainment, Bollywood, Music, Video and Breaking news, Rediffmail NG, Shopping").ChildObjects(olink)
'The script will pass the total number of links present in the message box 
msgbox olinkcoll.Count
For i=0 to olinkcoll.count-1
lslink=olinkcoll(i).GetROProperty("name")
lsurl=olinkcoll(i).GetROProperty("Link")
wsh.Popup lslink,1,"The link name is"
wsh.Popup lsurl,1,"The url of the link is"
Next

'Default flight Application


Dlgname=Dialog("nativeclass:=#32770").GetROProperty("text")
msgbox Dlgname
lsbtnstatus=Dialog("text:="&Dlgname).winbutton("text:=OK").getroproperty("enabled")
If lsbtnstatus Then
msgbox "PASS"
End if






Related Posts:

  • Steps to follow before starting Automation Steps to follow before starting Automation Analyze the Manual Test Cases                      a) Requirement Test suite creation          … Read More
  • Priority and Severity in Testing. Severity and Priority in Testing? As usually, Tester select Severity of bugs and Project lead or project manager selects bug priority. Priority - Priority is the order in which developer has to fix the bug. Severity … Read More
  • Generation of Scripts for Windows Application Generation of Scripts for Windows Application Record and Playback:Dialog("Login").WinEdit("Agent Name:").Set "admin"Dialog("Login").WinEdit("Password:").Set "mercury"Dialog("Login").WinButton("OK").ClickWindow("Flight Reser… Read More
  • Outcome of Running the QTP Scripts Outcome of Running the QTP Scripts Report in UFT 1. Test Fusion Report: 2. Customized Report (Framework):… Read More
  • UFT Keyboard Shortcut commands UFT Keyboard Shortcut commands  Frequently Used Shortcut keys: To comment block of statements: Ctrl+M To uncomment block of statements: Ctrl+Shift+M To apply “With” to script: Ctrl+W To remove “With” from script: Ctrl… Read More

0 comments:

Post a Comment

Blog Archive

Translate

Popular Posts

Total Pageviews

150,615

Blog Archive