Tool tip is the text that displayed after putting the mouse hover on the object. In QTP we have various ways to identify the tool tip.
1. If we are going to identify the tool tip of the Image object into the application than "alt" property will give you a tool tip of the object. for example in the below screen shot we have to verify tooltip of redBus image as redBus.in India's
Spy this image than you will get the properties of the image object and tool tip is mentioning against the alt property , just capture it with the use of GetRoProperty method
msgbox Browser("redBus : Online Bus Ticket").Page("redBus : Online Bus Ticket").Image("redBus.in").getroproperty("alt")
2nd Way : If we have to find out the tooltip of any link than we have to use title property to find out the tooltip.and Simailary as above we can find it.
3rd Way - Xpath(Xpath only applicable on QTP above version 10)
In the above code , for xpath we need Class and Property with their values, so in the above code we have the Class as img and properties are alt ="Logo". we can use more than one property also. so synatx would be for xpath is.
1. If we are going to identify the tool tip of the Image object into the application than "alt" property will give you a tool tip of the object. for example in the below screen shot we have to verify tooltip of redBus image as redBus.in India's
Spy this image than you will get the properties of the image object and tool tip is mentioning against the alt property , just capture it with the use of GetRoProperty method
msgbox Browser("redBus : Online Bus Ticket").Page("redBus : Online Bus Ticket").Image("redBus.in").getroproperty("alt")
2nd Way : If we have to find out the tooltip of any link than we have to use title property to find out the tooltip.and Simailary as above we can find it.
3rd Way - Xpath(Xpath only applicable on QTP above version 10)
First question arise How to create the xpath to identify the object so for Xpath wecan use firefox addin firpath or we can also create it. lets take an example
In the Below screenshot we have to identify the image or logo of university.
Just press the F12 on the webpage and spy the properties of inspector than you will get the html code like below
In the above code , for xpath we need Class and Property with their values, so in the above code we have the Class as img and properties are alt ="Logo". we can use more than one property also. so synatx would be for xpath is.
Set oPage=Browser("Kurukshetra University").Page("Kurukshetra University")
Dim tooltip1 = oPage.Image(“xpath:=//img[@alt=‘logo’]”).getroproperty(“alt”)
Msgbox tooltip1
No comments:
Post a Comment