WORKING WITH QTP

TestEveryThinG

Select the row in WEBTABLE/WEBGRID using QTP/DOM

Posted by rajivkumarnandvani on July 23, 2011

Hi All,

I found that most of time while working with WEBTABLE we need to the select the row based on some criteria by clicking checkbox or radiobutton.For that first we have to find the row which we have to select based on value of that row like text/link inside the row.
Here I am giving an example how to select a row in Webtable by finding the text. Logic I am using here is first i will find the row number from webtable where my searching text is present using GetRowWithCellText method then I will provide the column name/index of webtable where checkbox is present.


In below mentioned example I will select the row where Confirmation Number is “15204
Let’s see

Select Date ConfirmationNumber User Name Organization Name
17-SEP-2008
13761
 SMITH’S LP SUPPLY CO.
24-OCT-2008
13808
 Micro Motion test1
30-OCT-2008
13874
 EMERSON PROCESS MANAGEMENT ASIA PACIFIC PTE LTD
13-JUN-2009
15058
 Spartan Controls Ltd.
08-AUG-2009
15204
 Emerson Process Management

 Click here to get full details…

http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-141998662587146404
http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-141998664278824982
http://www.flipkart.com/affiliate/displayWidget?affrid=WRID-141998667291069023

Advertisements

8 Responses to “Select the row in WEBTABLE/WEBGRID using QTP/DOM”

  1. rose mary said

    This Method already available in QTP Help. U waste the time for find this method. Already this article published in AdvancedQTP forums.

    Share new things.

    Dont share already available method.

  2. Hi Rose,
    Thanks for the beautiful comment 🙂 and reading my blog. Yes you are right this method already available in QTP Help & AdvancedQTP forums.But still we ask queries about webtable over internet/post. some one asked me the same thing so i posted this on my blog with an example so that they can understand it easily.This is not a waste of time everything is available in QTP Help. Here I posted all my learning’s and useful things those i liked.maybe it is not useful for you but that does not mean it is not useful for others.There are many books available in market for the same subject but still people read those. Every time if we read the same thing in different way it will increase thinking /logic. Here my intention not to point you this is for everyone may be some like or some not. I do not think so everyone reads the whole qtp help file. I always says QTP help file is the best book i have ever read.

  3. mahesh said

    Hi Can tell me method to select the Check Box Depending on Selcted text in the data table

  4. mahesh said

    Hi Can u tell me a method to select the Check Box Depending on Selcted text in the data table

  5. Please clarify what do you means selected text in data table.How to do u select the text in data table( data grid).?

  6. Nebyu said

    Hi,

    I have a requirement to verify a row in a yellowish color. The colored wegrid row can be any row depending on the business senario/
    Can any one have any idea how to verify colored webgrid row in QTP?
    please respond to nebyust@gmail.com

    I appreciate your help.

  7. currentStyle object!
    The main idea is to read:
    WebElement(“SomeName”).Object.currentStyle.someProperty
    For example, use:

    * color property to get the color of the text
    * backgroundColor property to get the backgroung color (behind the content of the object)
    * fontSize property to get the font size
    * fontStyle property to get the font style
    * fontFamily property to get the font family
    * fontWeight property to get the font weight
    * and so on

    Please, read more detailed info on properties of currentStyle object:

    So, I used this code in my QTP script:

    Dim ctrlWebEl, objWebEl

    Set ctrlWebEl = Browser(“Welcome to Gmail”).Page(“Welcome to Gmail”).WebElement(“Welcome to Gmail”)
    Set objWebEl = ctrlWebEl.Object

    sColor = objWebEl.currentStyle.color
    sBackgrColor = objWebEl.currentStyle.backgroundColor
    sFontSize = objWebEl.currentStyle.fontSize
    sFontStyle = objWebEl.currentStyle.fontStyle
    sFontFamily = objWebEl.currentStyle.fontFamily
    sFontWeight = objWebEl.currentStyle.fontWeight

  8. Anonymous said

    Where DOM comes in your code?

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: