Showing posts with label Descriptive Program. Show all posts
Showing posts with label Descriptive Program. Show all posts

Saturday, 17 May 2014

QTP-UFT - how to you describe a object using descriptive programming



'We can use Description.create

Set obj = Description.Create
obj("micclass").value = "Image"
obj("name").value = "Sample"

'in the above case we have define a object of "Image" type and whos name is "Sample"

We can also use additional properties like outertext, innertext, Class, x, y etc. to create these descriptions.

Tuesday, 29 April 2014

UFT - QTP - How do you find the number of links in a page





 Assume we are want to find all links on "Uftquestions.Blogspot.in" page.

Set objPage = Browser("name:=UFTquestions.*").page("title:=UFTquestions.*")
Set objLink = Description.Create
objLink("micclass").value = "Link"
Set objChildLink = objPage.ChildObjects(objLink)
msgbox objChildLink.count


You may try for any other pages by Replacing the "UFTquestions.*" with any other Page title where ".*" represents regular expression.

Message box will show you the number of links on the page.

Regards,
Sreenu Babu