Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Spying HTML Table
#1
Not Solved
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


Attached Files Image(s)
   
Reply
#2
Not Solved
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.
Reply
#3
Not Solved
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]


Attached Files Image(s)
   
Reply
#4
Not Solved
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Customized HTML reports in QTP azeem 11 48,309 12-31-2016, 02:57 PM
Last Post: chevronneraji
  [UFT] Get text into DIV through HTML tag robertosalemi 2 5,271 03-29-2016, 09:43 PM
Last Post: robertosalemi
  How to attach HTML file to Email Naresh 0 2,740 04-06-2015, 02:04 PM
Last Post: Naresh
  System hangs while spying an object in Windows 7 OS prithwiraj1990 0 1,941 08-06-2013, 05:45 PM
Last Post: prithwiraj1990
  How to generate QTP report in a new file(html)? yogesh kancherla 5 14,455 10-21-2012, 04:52 PM
Last Post: yogesh kancherla

Forum Jump:


Users browsing this thread: 1 Guest(s)