Issues in identifying DIV with QTP:


Issues in identifying DIV with QTP:
Div stands for division and in case of HTML document,it defines a section in an document.
Nowadays developer prefer DIV over TABLE for design purpose.I have had heard that elements within DIV loads faster than within Table;i don’t know what is the exact difference and don’t want to discuss 🙂 as it’s out of scope as of now.QTP has a set of methods and properties for Table under micclass WEBTABLE, testers often come across the scenario when they have to choose between two alternatives TABLE and CHAIR, oh! no! 😉 CHAIR is not there,need to work on table without sitting on the chair?
Yes, if we have QTP we can do it too,that’s why i am against the saying “Pen is mightier than sword”, i believe “QTP is mightier than sword”.

Well,we need to fetch the “Class” or “Id” attribute in order to identify the particular DIV in HTML document object model and our mightiest code is as follows:

Code:

Function Identify_DIV()

Dim Obj

Set Obj= Description.Create

Obj("micclass").Value = "WebElement"  ' alternative

Obj("html tag").Value = "DIV"

Obj("class").Value = "header"

Browser("micclass:=browser").Page(Obj).Click

Wait(2)

'Set Obj =Nothing

End Function

Raw DIV Code:

Raw DIV in QTP

Advertisements

6 responses to this post.

  1. Posted by Frank Sisto on June 30, 2011 at 1:44 pm

    Good use for the Desc obj, thanks.

    Reply

  2. Posted by Anonymous on September 8, 2011 at 1:04 pm

    thanks Bro..

    Reply

  3. Posted by mmm on October 9, 2012 at 6:49 am

    how can you pass webelement object to page?
    this is not working.

    Reply

  4. Posted by Nallasivam on April 24, 2013 at 1:41 pm

    Thanks for ur description on Div object

    Reply

  5. Posted by Victor on February 20, 2016 at 2:59 pm

    Hi, is there a way to get the rows and columns of a table constructed entirely with divs?
    I have a table with no tag. It is constructed entirely using for rows and for the columns. How can I get the content of each cell and print it?
    Thanks

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: