Get Row/Column Of An Object in a WebTable

by Anshoo Arora ON June 27, 2011 · Posted In All, QTP, QTP/Web · 68 comments

This article shows a simple way of finding out in which cell a QTP’s Test Object resides. I find the method shown in this article a more effective and faster way of finding the cell I’m looking for. I have found that this method performs better than traversing rows/cells of a WebTable using in-built WebTable methods such as ChildItem, ChildItemCount and GetCellData. Also, for test objects, it is also not possible to find an exact match with the methods provided for WebTable – it is only possible for strings.

A workaround to find objects inside WebTable using DOM table/tr/td is shown in this article. The code snippets below show how to retrieve the row and column of a given object from a WebTable.

Consider the element “Doe” in the table below. We can visually see that the link is in the 5th row (starting at the heading) and the 3rd column.

ID First Name Last Name Gender Attending class?
12345 John Smith M
12346 Anne Johnson F
12347 Adam Roberts M
12348 Mary Doe F
12349 Tiffany Smith F

Executing the following code will provide us our expected output:

Set element = Browser("creationtime:=0").WebElement("innertext:=Doe", "index:=0")

MsgBox "Row# " & element.GetRow()
MsgBox "Col# " & element.GetColumn()

The above example uses WebElement, but this approach works for all Web objects. Similarly, the code for finding the 2nd WebCheckBox for Anne Johnson will give us: Row# 3 and Column#5 with the following code:

MsgBox Browser("creationtime:=0").WebCheckBox("name:=attending", "index:=1").GetRow
MsgBox Browser("creationtime:=0").WebCheckBox("name:=attending", "index:=1").GetColumn

The Code

The following two methods can be used directly for the object and will retrieve ‘either’ the row or the column. The below method retrieves the Row for an object residing in a WebTable:

Find Row of the Object from WebTable
Function GetRow(ByVal TObject)
    GetRow = -1
 
    Set TObject = TObject.Object
 
    Do
        If TObject.nodeName = "TR" Then
            GetRow = TObject.rowIndex + 1
            Exit Function
        End If
 
        Set TObject = TObject.parentNode
    Loop Until TObject.nodeName = "HTML"
End Function
 
RegisterUserFunc "Image", "GetRow", "GetRow"
RegisterUserFunc "Link", "GetRow", "GetRow"
RegisterUserFunc "WebEdit", "GetRow", "GetRow"
RegisterUserFunc "WebList", "GetRow", "GetRow"
RegisterUserFunc "WebCheckBox", "GetRow", "GetRow"
RegisterUserFunc "WebElement", "GetRow", "GetRow"
RegisterUserFunc "WebRadioGroup", "GetRow", "GetRow"
Example
MsgBox Browser("title:=myBrowser").Link("innertext:=myLink", "index:=1").GetRow

This method returns the column of the object inside a WebTable:

Find Column of the Object from WebTable
Function GetColumn(ByVal TObject)
    GetColumn = -1
 
    Set TObject = TObject.Object
 
    Do
        If TObject.nodeName = "TD" Then
            GetColumn = TObject.cellIndex + 1
            Exit Function
        End If
 
        Set TObject = TObject.parentNode
    Loop Until TObject.nodeName = "HTML"
End Function
 
RegisterUserFunc "Image", "GetColumn", "GetColumn"
RegisterUserFunc "Link", "GetColumn", "GetColumn"
RegisterUserFunc "WebEdit", "GetColumn", "GetColumn"
RegisterUserFunc "WebList", "GetColumn", "GetColumn"
RegisterUserFunc "WebCheckBox", "GetColumn", "GetColumn"
RegisterUserFunc "WebElement", "GetColumn", "GetColumn"
RegisterUserFunc "WebRadioGroup", "GetColumn", "GetColumn"
Example
MsgBox Browser("title:=myBrowser").Link("innertext:=myLink", "index:=1").GetColumn

The below implementation retrieves both row and column as a Scripting.Dictionary.

Find Row & Column Info as Scripting.Dictionary
Function CellInfo(ByVal TObject)
    Dim dic
 
    Set dic = CreateObject("Scripting.Dictionary")
    dic.Add "row", -1
    dic.Add "col", -1
 
    Set TObject = TObject.Object
 
    Do
        If TObject.nodeName = "TD" Then dic("col") = TObject.cellIndex + 1
 
        If TObject.nodeName = "TR" Then
            dic("row") = TObject.rowIndex + 1
            Exit Do
        End If
 
        Set TObject = TObject.parentNode
    Loop Until TObject.nodeName = "HTML"
 
    Set CellInfo = dic
End Function
 
RegisterUserFunc "Image", "CellInfo", "CellInfo"
RegisterUserFunc "Link", "CellInfo", "CellInfo"
RegisterUserFunc "WebEdit", "CellInfo", "CellInfo"
RegisterUserFunc "WebList", "CellInfo", "CellInfo"
RegisterUserFunc "WebRadioGroup", "CellInfo", "CellInfo"
RegisterUserFunc "WebElement", "CellInfo", "CellInfo"
RegisterUserFunc "WebCheckBox", "CellInfo", "CellInfo"
Example
Set cells = Browser("title:=myBrowser").Link("innertext:=myLink", "index:=1").CellInfo()

MsgBox cells("row")
MsgBox cells("col")

cells.RemoveAll
Set cells = Nothing

I hope you find this helpful. As always, thanks for visiting Relevant Codes :)

Subscribe to Relevant Codes (by Anshoo Arora)

Hello! We're always posting interesting articles on Relevant Codes. Why not subscribe so you don't miss out?

Leave a Comment

{ 68 comments… read them below or add one }

SAM May 18, 2012 at 2:21 am

Hi Anshoo and Team,
I would like to know if someone has encountered below scenario –

#### ISSUE :- Error Cell Does NOt exist

Scenario :- Webtable having 2 columns and 10 rows and for Few Cells does not exists

For Row,Col of (2,2), (2,4)(2,6) if we try to get a string using below code then we ger the String value as – “Error Cell Does NOt exist”

Str = Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebTable(“name:=WTable”).GetCellData(2,2)

Query :-Here there is only 1 WebTable in which few cells do not exists So How can we check that particular Cell itself does not exists and skip it ?

Thw current workaround is after checking the above error message we can modify the output data which we can send to results

Reply

ravi May 7, 2012 at 6:28 am

Hi Anshoo,

if my webpage has no webtable and having 10 checkboxes so in this scenario can we use chiditem method to select the checkbox? if we know the Index of the particular checkbox can u pls let me know with an example, what is the purpose of mentioning the row and column in the childitem method. childItem(row, column, micclass, index).

Reply

Amit May 4, 2012 at 11:56 am

How to click on a empty cell of a webtable which is a link

Reply

Mohan April 13, 2012 at 1:30 am

Hi Anshoo,

Set element = Browser(“creationtime:=0″).WebElement(“innertext:=Doe”, “index:=0″)

MsgBox “Row# ” & element.GetRow()
MsgBox “Col# ” & element.GetColumn()

This Code is not working on My Environment.
Currently iam using QTP 11 and IE is 8 Version

Reply

Anshoo Arora April 14, 2012 at 8:40 am

Mohan, what is the error message? Have you associated the function in your function library and included RegisterUserFunc portion for the WebElement?

Reply

Mohan April 13, 2012 at 12:50 am

Hi Anshoo,

Here the Script copying the Data from webtable to ExcelSheet.

My Question is Every time when i Executing this Script it Displaying this pop-up as
MyTest.xls File is Already Exists in the Location.Do you want replace it? with “ok”,”No”,”Cancle”.

Globally How can i handle this type of issue.Don;t want click every time on the oK.

How to Handle this issue.

Set MyTable =Browser(“1st Test: West Indies”).Page(“1st Test: West Indies_2″).WebTable(“West Indies 1st innings”)
Set MyExcel = CreateObject(“Excel.Application”)
Set MySheet = CreateObject(“Excel.Sheet”)
MySheet.Application.Visible = True
For Row = 3 to MyTable.RowCount Step 2

For i=1 to 9
MySheet.ActiveSheet.Cells(Row,i).Value = MyTable.GetCellData(Row,i)

Next
Next
Wait(2)
MyExcel.Application.SaveWorkspace “C:\Test\MyTest.xls”
MyExcel.Application.Quit
Set MySheet = Nothing
Set MyExcel = Nothing

Reply

Anshoo Arora April 14, 2012 at 8:43 am

Mohan: It seems the file already exists in the given location and you are trying to overwrite it. If that is the case, make sure you are saving it as a different file-name.

Reply

Deepa March 26, 2012 at 8:10 am

Hi Anshoo,

I have a scenario like
“I do create a request and each time a request number is created. This requests numbers are updated in a Web Table as and when a new request is created. The table goes to next next pages. I am not sure of in which row my request number is displayed.
I have to search for the request number in the first page and if not found I have to go next page and search and so on.

Please help me with a loop structure for getting this resolved.

Thanks in advance
Deepa

Reply

venkataramana March 14, 2012 at 5:19 am

Is Xpath and CSS object identification exist in the QTP or not. if yes, how xpath and css object identification done in QTP.
Please tel me about that.
Thank u.

Reply

Anshoo Arora March 15, 2012 at 9:30 am

Venkataramana, its possible. Example:

'Google home
Browser("title:=Google").WebEdit("xpath:=//input[@name='q']").Set "xpath with qtp"

Reply

Thomas March 9, 2012 at 5:33 am

i have written a script in .vbs file while running it is displaying an error undeclared variable “Description” what i have to do to get rid of the problem

Reply

Anshoo Arora March 15, 2012 at 9:19 am

Thomas, ‘Description’ is an object and a reserved word in QTP.

Reply

Piyush February 29, 2012 at 12:04 pm

Hi anshoo,

please help me know what exactlly getcelldata returns from particular row n column in web tabe,does it return any object name or value of any property of that object,however from ur post I get to kno that how we can getrow() n getcolumn() for an object.but I need to kno what variable “a” may contain in following code
a = (Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours_2″).WebTable(“Registered users can sign-in”).GetCellData(2,1))
please let me kno what “a” will contain
thanks,
piyush

Reply

Anshoo Arora March 15, 2012 at 8:35 am

Piyush, it only returns the ‘data’ inside the cell – that is, all text. Your code should return the text from the 2nd row and 1st col of the table.

Reply

Neelam February 29, 2012 at 3:53 am

Hi anshoo can you share your e mail id pls .. i have to clear some doubts about QTP

Reply

Anshoo Arora March 15, 2012 at 8:32 am

Neelam, you can use the contact form or mail me at ‘anshoo [dot] arora [at] relevantcodes [dot] com’. However, I only respond to confidential/corporate queries via mail. If its neither, please use the comments section.

Reply

ARPITA February 27, 2012 at 12:46 am

Thanks Anshoo,
Now its working for me.Inside tools one web event recording is there.Then click on custom setting .Select onclick option with always.And then its working.

Reply

ARPITA March 15, 2012 at 1:55 am

Hi Anshoo
I have a question.Inside a table another table is there.And in that table 5 to 6 columns are there.Some letter are in bold letter.and some letter are in normal.First time if we are doing any operation then its bold.After finished that operation then it becomes normal.
How to identify that bold letter inside table???
QTP identify as Browser(“micclass:=Browser”).Page(“micclass:=Page”).Frame(“Index:=2″).WebTable(“name:=XXX”).WebTable(“name:=fff”).webElement(“innerhtml:=mmm“)
But bold letter is not coming
One thing i want tell u that QTP is not identify 2nd web table name.It identify the name as column name’s one element.But column name’s that element change if we will do different operation.
Please reply

Reply

Vimal Raj March 15, 2012 at 2:06 am

Hi Arpita,

If I’m in your situation, I prefer doing it using a DOM way. Try using DOM method, it will be an easiest way to achieve the result what you were expecting.

Regards,
Vimal

Reply

Anshoo Arora March 15, 2012 at 9:39 am

Arpita, the bold elements will have a unique property assigned to them which the normal ones won’t. Example:

'css:
#boldwords{font-weight: bold;}
#normalwords{font-weight: normal;}

You can use the class above, or font-weight from DOM:

MsgBox Browser(").WebElement("").object.currentStyle.fontWeight

Reply

ARPITA February 14, 2012 at 6:52 am

Hi Anshoo,
I have a question.In a web page table is there.Browse button is there inside table.if we click that browse button then file will attach.But QTP doesn’t recognize that browse button.Only it recognize that table but not recognize inside the object means that button.
when i am using object spy its also recognize only table.Can u suggest me some idea how to click that object which is not recognize by qtp.
This is my code
Browser(“micclass:=Browser”).Page(“micclass:=Page”).Frame(“Index:=1″).WebTable(“name:=sss”).WebElement(“name:=detailtextdata”).Click.
Plz reply

Reply

Anshoo Arora February 16, 2012 at 10:51 am

Arpita, can you share the source code of the page or a sample page where I can test this?

Btw, have you tried using .ChildItem?

Browser().Page().WebTable().ChildItem(1, 1, "WebElement", 1).Click
Browser().Page().WebTable().WebElement("innertext:=Browser", "index:=1").Click

Reply

ARPITA February 14, 2012 at 3:40 am

Thanks Anshoo,
Your code is working fine

Reply

ARPITA February 9, 2012 at 1:51 am

Anshoo ,
Again Arpita here.I am giving you the code what i have written.But its not able to click the link
rowcount1 = Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebTable(“name:=TT”).RowCount
msgbox rowcount1
c = 4
For x = 2 to rowcount1
Y = Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebTable(“name:=TT”).GetCellData(x,c)
If Y = “ZZZ” Then
ID1 =Browser(“micclass:=Browser”).Page(“micclass:=Page”).WebTable(“name:=TT”).GetCellData(x,1)
msgbox ID1
Browser(“micclass:=Browser”).Page(“micclass:=Page”).Frame(“Index:=2″).WebTable(“Name:=TT”).Link(“name:=ID1″).Click

End If

Next

Thanks
Arpita

Reply

Anshoo Arora February 13, 2012 at 12:18 pm

Arpita, does the following work:

Browser(“micclass:=Browser”).Page(“micclass:=Page”).Frame(“Index:=2″).WebTable(“Name:=TT”).ChildItem(1, 1, "Link", 0).Click

Reply

ARPITA February 9, 2012 at 1:38 am

Hi Anshoo,
I have a web table like u mentioned in top.In my table there are 27th row and 7 column.In 4th column i have different value like zzz,aaa,bbb,ccc,zzz .One can be multiple time like zzz .I have to search zzz from 4th column and click on a respective hyperlink which exist in 1st row .1st row is a number but link is there how to click that link?Can u suggest some answer?

Reply

Anshoo Arora February 13, 2012 at 12:17 pm

Arpita, have you tried using ChildItem? Does that solve this dynamic binding to the target object?

Reply

John February 7, 2012 at 7:11 pm

Hi Anshoo, thanks for putting this post together. .nodeName, .parentNode and .rowIndex are going to save me a lot of time on my current automation project. Well done.

Reply

Piyush February 4, 2012 at 4:00 am

Hi Anshoo,
how wud we know that index=0 for this element and creationtime=0 for Browser in following step?
Set element = Browser(“creationtime:=0″).WebElement(“innertext:=Doe”, “index:=0″)

Thanks,
Piyush Kotiyal

Reply

Anshoo Arora February 13, 2012 at 12:10 pm

CreationTime of 0 means we’re pointing to the first open browser. CreationTime of 1 means we’re pointing to the second open browser and so on.

We determine Index by the internal (HTML) placement of the object. Index of 0 means, in the HTML source, that particular object is the first to appear.

Reply

Muzaffar January 25, 2012 at 12:19 pm

Hello Anshu!
Recording this page and using code snippets gives error “Object doesn’t support Browser(….”

how to solve this issue?

Reply

prasad January 17, 2012 at 11:06 am

Assume there are 5 rows and 5 cols in one web table and all cols and rows are having data
I want script to read all data at a time

Reply

Anshoo Arora February 13, 2012 at 10:45 am

Prasad, see the GetCellData method of the WebTable. You will use that to loop each cell of the table to retrieve data. Something like the following:

For row = 1 to 5
    For col = 1 to 5
        Print Browser().Page().WebTable().GetCellData(row, col)
    Next
Next

Reply

Gaurav November 30, 2011 at 1:27 am

Thanks for this article. Now working with web tables has become easy .

cheers. Gaurav

Reply

vasanth November 21, 2011 at 2:20 am

what’s use of RegisterUserFunc?

Reply

Dinesh November 11, 2011 at 7:01 pm

@ Nishant – Thats exactly i want to find out.
Do you have any suggestion?

Reply

Partha November 10, 2011 at 10:29 am

Example to the previous question:

For i = 100 to 1 step -1
Some condition
StrCompare ( comparing two strings)
condition satisfied
Exit for ( in the row 51)

Now I want the loop to start from 51
but it is starting from 100th row again.

Reply

nishanth November 11, 2011 at 8:40 am

I think one way to do this is to store the number in an environment variable and update the env variable whenever the condition is satisfied.

Reply

Partha November 10, 2011 at 10:20 am

Anshoo,
I have a webtable with hundreds of rows and I am using a for loop to go throught the rows and perform actions based on conditions satisfied. When the condition is satisfied it comes back of the loop and start looking for other condition and go through the loop again starting from the top row again. I want to eliminate this, I want QTP to start looking for for the condition from the row where it was left. How to do this?

Thanks
Partha

Reply

Anshoo Arora December 27, 2011 at 6:43 am

You can store the last row in a variable and force the loop to start from there.. Example:

lastRow = 1

For ix = lastRow To WebTable.GetROProperty("rows")
    If conditionIsMet Then
        lastRow = ix
    End If
Next

Reply

Dinesh October 11, 2011 at 3:10 pm

Hey Anshoo,
First of all thank you for sharing all your methods and approaches.
Here is a scenario i have, in a web table, I want to find out the first child objects present within a cell (row and col is input parameter). i.e in a cell (say row 2, col 2) i have some objects present which i will know only at runtime. it can be a check box or a radio button or a link..anything. Now how can i find the first child object present in the cell?

Once i find out the first child object, i will set that object as my control to perform my next operation.

How to do that? without using childobjects or childitem because here i need to mention the micClass to identify the object.

Please advice

Dinesh

Reply

nishanth November 11, 2011 at 9:00 am

Do you mean to say that one cell in the webtable contains more than one object and you want to find out the first object in that cell?

Reply

Dinesh November 11, 2011 at 7:03 pm

@Nishant.. Yes thats exactly what i want to do… do you have any suggestions?

Reply

Prasath October 8, 2011 at 7:06 am

Sorry the above post with invalid HTML, here is the proper one..


” row1
” rowvalue1
” rowdesc1


” row2
” rowvalue2
” rowdesc2

“”

Reply

Prasath October 8, 2011 at 7:02 am

Hi Anshoo
Thanks for a wonderful explanation to retrieve row & column values.
How can we retrieve innertext property of all cells by row & column which is inside multiple webtables.
For eg: consider the following html snippet,

row1
rowvalue1
rowdesc1

row2
rowvalue2
rowdesc2

Thanks.

Reply

nishanth October 7, 2011 at 7:22 am

HI Anshoo,

A basic question. When should we go for using WebTables?

thanks,
Nish

Reply

Anshoo Arora October 11, 2011 at 4:50 pm

Nishanth: Not sure what you mean? WebTables are in the target app..

Reply

nishanth December 7, 2011 at 8:07 am

I was asked this question in an interview. How do you verify if a particular mail is present in the Yahoo Inbox?. I started saying…”I will see if there is a property which holds the subject or some information which identifies this mail and…” . Even before I finished my answer the interviewer interrupted me and said, what if it is a webtable? I started telling him that if its a webtable then I will use the GetCellData, the Rows and Cols properties etc to get the value. Even before I could finish he interrupted again and said that it is indeed a webtable. His tone was like…”the yahoo inbox is a webtable…how come you dont know about it?”

I never worked on Yahoo Inbox so I never thought whether its a webtable or not.
Now my question is…just by looking at a web application do we come to know which is a webtable and which is not?

When should we go for using the webtable methods and properties? Sometimes to get a value of an object GetROProperty also works along with webtable methods? So when should we go for using webtable methods? what is the best scenario for using webtable methods and properties?

I am still in the process of learning QTP. I feel comfortable working with Webtables but I dont know when I shud use WebTables methods and properties. Please reply.

Reply

Anish 10110 September 12, 2011 at 8:48 am

Anshoo,

This is a very good article. Good to know about many different ways of using the same thing :) :)

As you told that ‘method performs better than traversing rows/cells of a WebTable using in-built WebTable methods’, does it mean that this is faster than the WebTable methods?

Reply

Anshoo Arora September 12, 2011 at 10:24 pm

Its certainly a very quick way to retrieve the row and column of a given object :)

Reply

QTPLearner August 22, 2011 at 11:02 pm

Can you help me in scripting of current SignOut for Gmail , which got changed by google…

Reply

Anshoo Arora September 12, 2011 at 10:16 pm

QTPLearner: For Gmail SignOut, please see if the below works:

Browser("title:=Gmail.*").WebTable("html id:=gbmpal").Link("innertext:=Sign out").Click

Reply

Reena July 28, 2011 at 12:59 am

Hi Anshoo,

Thanks for the code .
Iam beginner in QTP . Could you assit me , if I would need to add the above the method to the QTP library or do i need to use it directly ?
Mail me at reachreenadey@gmail.com
Thanks ,
Reena

Reply

Anshoo Arora August 1, 2011 at 4:16 pm

Reena: Please follow the steps below to add this function as to your test.

1. Create a new function library from File -> New -> Function Library
2. Add the above methods with the RegisterUserFunc statement to the library
3. Save it
4. Associate it with your test from File -> Associate Library ‘LibraryName’ with ‘TestName’
5. Save the test

Reply

Nishanth July 18, 2011 at 2:21 pm

I am getting a null value(a blank message box)
I also have another question regarding webtables.
Scenario1:I have the application ready, I am recording on it and I want to insert a Table Checkpoint to verify a value in a particular cell. When the Table checkpoint property window opens I go through the table and if I see the value that I want to check then I select that cell. I run the test case and it executes the checkpoint. Passes or Fails. Life is easy
Scenario2: The application is ready but I want to do this programatically. How should I know which cell has the value in it?
And more importantly how should I know in which webtable is this cell present? Is it only by going thru one table after the other?
Scenario3: The application is not ready. How can I use webtables? Is it only by looking at source code?

Reply

Anshoo Arora August 1, 2011 at 3:56 pm

Nishanth,

Scenario 1, 2: The below code will dynamically retrieve values from all rows/columns from the table you’ve referenced:

With Browser("title:=.*Mercury Tours.*").WebTable("innertext:=Registered.*")
	iRows = .GetROProperty("rows")
	iCols = .GetROProperty("cols")

	For row = 1 to iRows
		For col = 1 to iCols
			Print .GetCellData(row, col)
		Next
	Next
End With

Scenario 3: Well, if you have the source code you can certainly do a lot. However, if the application is not ready means the required source code may not be available in the first place. It will be very tough to automate anything without having something concrete to begin with.

Reply

Nishanth July 9, 2011 at 6:52 am

Hi Anshoo,
I created a table checkpoint on the username and password edit boxes in the newtours.demoaut.com appln. There are2 columns and 5 rows. The 2row,1col contains constant UserName: and 3row,1col contains constant Password:. Now during run time I am inserting username as xyz123 and password as xyz123.
Now my question is…dont these values get updated in the 2nd row, 2nd col and 3rd row, 2nd col of the webtable respectively.
After inserting the username and password values I wrote the below 2 lines of code.
a = (Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours_2″).WebTable(“Registered users can sign-in”).GetCellData(2,1))
b = (Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours_2″).WebTable(“Registered users can sign-in”).GetCellData(2,2))
msgbox a ‘Returns UserName:
msgbox b ‘Returns a null value

why I am not getting xyz123 in the second msgbox? Please explain how this stuff works. Will be grateful.

Reply

Anshoo Arora July 17, 2011 at 7:46 pm

Nishant: What is the output you’re getting?

Reply

PJ July 8, 2011 at 10:35 am

Hi Anshoo

I have created wrapper function arround the original qtp functionality if i want to do any operation
like
Button click operation
Image click ,mouseover operation
Is it Good way to do qtp scripting?
Any suggestion to enhanced these Wrapper function?

Reply

Anshoo Arora July 16, 2011 at 11:49 am

PJ: I can only say that it will only be meaningful to create wrapper functions if they serve a greater purpose than existing QTP functions. If your button click operation ‘only’ clicks the button, then it will be redundant.

Reply

PJ July 18, 2011 at 2:50 am

Anshoo Arora July 16, 2011 at 11:49 am
PJ: I can only say that it will only be meaningful to create wrapper functions if they serve a greater purpose than existing QTP functions. If your button click operation ‘only’ clicks the button, then it will be redundant.

=>
the Error handling part is also done inside wrapper function.if error comes then execution of current test stop.

Reply

Kashyap July 5, 2011 at 6:14 am

Very good article.

It’s a shame that QTP will let us use the DOM properties using “object” only on IE browser.
If this could be used on Firefox, it would be great.

Because of this reason , this great approach can only work on IE window.

Reply

Anshoo Arora July 6, 2011 at 8:16 pm

Kashyap: What version of QTP are you using? QTP 11 supports Record/Playback and DOM commands with Firefox.

Reply

Prabhu June 28, 2011 at 10:24 am

Interesting and simplified way to deal with Webelements inside Webtable.

Reply

Anshoo Arora June 28, 2011 at 2:16 pm

Thank you Prabhu. Also, this approach can be used for any Web object that resides in the WebTable. All we have to do is replace the reference to the WebElement with any other object inside the table.

Reply

Vimal June 28, 2011 at 9:34 am

Anshoo,

Again a wonderful topic from you. I had implemented this idea in my old project as said in the same way. Thought of writing it to my blog, but somehow I haven’t. Your efforts are appreciable.

Reply

Anshoo Arora June 28, 2011 at 2:12 pm

Thank you for your kind words Vimal. I searched the net a lot before making this post – I was afraid this may be a common technique which may already be available somewhere. But, because I was not able to find it, I thought to share it.

Reply

Anshoo Arora December 27, 2011 at 7:02 am

Nishanth: That remark is not justified. The guy wasn’t sure what he was talking about. What if somebody has never worked with the Yahoo app? What then? There is no way I can tell if its a WebTable or not without looking at the source. Just because it looks like a table does not mean it has to be it..

Be glad you didn’t get to work with that guy or you would come out learning very little. :)

Reply

Previous post:

Next post: