Micro Focus QTP (UFT) Forums
Help with Spying HTML Table - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Help with Spying HTML Table (/Thread-Help-with-Spying-HTML-Table)



Help with Spying HTML Table - gsatle - 09-30-2010

I am building a QTP automation script with this web page that involves checking the checkbox (setting it ON) depending on the textual data provided (data driven)
But QTP is not identifying the HTML table for me to identify the corresponding row and text tick the corresponding checkbox. Currently QTP only identifies the texts, frames, checkbox and other lower level objects and not the HTMLtable.

Screenshot attached.

Can anyone please suggest how to spy the HTML table in QTP?

Thanks in adv,
Gaurav


RE: Help with Spying HTML Table - guin.anirban - 09-30-2010

If your objective is to select the checkbox corresponding to a text then you can follow the below logic.

First you get the all the text available in the page then store it either in a array or in a string. Then Split function to get individually and comapre with the actual text. As well as take the count of the number of the text.

Now you take the count of checkbox in that page and then select the checkbox same to the number of text.


RE: Help with Spying HTML Table - cdesserich - 10-01-2010

Sounds to me like it is one of two reasons:

1. Either the table is something that looks like a table, but is not (like DIV and SPAN tags with borders) or;
2. You are not selecting the table out of the hierarchy when spying.

If it is number 2 see the attached capture of the Object Spy of this page. Notice that to look at the table properties, you have to select it in the hierarchy. The item you click on when spying is going to return the topmost object for the coordinates you click. If you want to get something deeper on the page, you have to explicitly select it down the hierarchy in the Spy or when you are adding it to the repository.

If it is number 1, then you are going to have to look at the page's source code to determine what kind of objects you are dealing with. If they are DIVs or SPANs with HTML IDs, you could try to define repository objects based on that information. If you could provide the source, I could be more helpful.

If you do end up finding that you can identify the WebTable, then one of the easiest ways to activate the correct WebCheckbox would be something like:

Code:
[color=navy][b]Dim[/b][/color] row

row = Browser([color=maroon]"<Browser Name>"[/color]).Page([color=maroon]"<Page Name>"[/color]).WebTable([color=maroon]"<Table Name>"[/color]).GetRowWithCellText([color=maroon]"<Text you want to search for>"[/color])

Browser([color=maroon]"<Browser Name>"[/color]).Page([color=maroon]"<Page Name>"[/color]).WebTable([color=maroon]"<Table Name>"[/color]).ChildItem(row, [color=maroon]3[/color], [color=maroon]"WebCheckBox"[/color], [color=maroon]0[/color]).[color=navy][b]Set[/b][/color] [color=maroon]"ON"[/color]



RE: Help with Spying HTML Table - jerel2k11 - 05-03-2011

I am having the same problem. QTP does not recognize the two items I need to check as being in a webtable.

I did a view source on the browse pop up window:
Code:
</script>
<table border=1 cellspacing='0' cellpadding='3' bordercolor='#E5E4E4' WIDTH="100%">
<tr>
  <th class='tableheading' width='5%'><input type=checkbox name="_ALL_" onClick="selectAllRowsSFCs();" >All</th>
  <th class='tableheading'  > SFC</th>
  <th class='tableheading'  > Item</th>
  <th class='tableheading'  > Qty</th>
  <th class='tableheading'  > Priority</th>
  <th class='tableheading'  > Date Queued</th>
  <th class='tableheading'  > Shop Order</th>
  <th class='tableheading'  > Status</th>
</tr>
<tr align="center" class="alternatetabletext" onDblClick="dblClickOneRowSFCs(0);" onClick="clickOneRowSFCs(0);" ><td ID="_DUMMY_CHECKBOX_" >&nbsp;&nbsp;<input ID="_CHECKBOX_" type=checkbox name="ROW0" ></td><td ID="SFC" >1004-SITE2-3-PRD1</td><td ID="ITEM" >1004-SITE2</td><td ID="QTY" >1</td><td ID="PRIORITY" >500</td><td ID="DATE_QUEUED" >4/7/11 2:53:03 PM</td><td ID="SHOP_ORDER" >000010015841</td><td ID="STATUS" >InQueue (RW)</td></tr>
<tr align="center" class="tabletext" onDblClick="dblClickOneRowSFCs(1);" onClick="clickOneRowSFCs(1);" ><td ID="_DUMMY_CHECKBOX_" >&nbsp;&nbsp;<input ID="_CHECKBOX_" type=checkbox name="ROW1" ></td><td ID="SFC" >1004-SITE2-4-PRD1</td><td ID="ITEM" >1004-SITE2</td><td ID="QTY" >1</td><td ID="PRIORITY" >500</td><td ID="DATE_QUEUED" >4/7/11 3:06:45 PM</td><td ID="SHOP_ORDER" >000010015841</td><td ID="STATUS" >InQueue (RW)</td></tr>

My goal is to select two SFCs e.g. 1004-SITE2-4-PRD1.

I've tried the above code by actually adding a webtable object but get error message saying the _ALL_ objects description matches more than one of the objects currently displayed in your app.

Code:
row = Browser("Certificate Error: Navigation").Page("CLN - Visiprise Manufacturing:_2").Frame("PodMain").WebTable("_ALL_").GetRowWithCellText("ITEMTEST1-1005-PRD1")
'intRow2 = objTable2.GetRowWithCellText("ITEMTEST1-1005-PRD1")
'msgbox intRow2
Set checkbox = Browser("Certificate Error: Navigation").Page("CLN - Visiprise Manufacturing:_2").Frame("PodMain").WebTable("_ALL_").ChildItem(intRow2,1,"WebCheckBox",0)
checkbox.Set "ON"

Any ideas?