Micro Focus QTP (UFT) Forums
Webtable - 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: Webtable (/Thread-Webtable--7583)



Webtable - ramesh - 08-30-2013

Hi All,
I am new to QTP's webtable.I have gone through some blog on webtable and for that moment I got to know how it works but when I tried with a example I am getting so many confusions.
I created a simple html page with a table
Code:
<table border="1" name="MyWebTable">
<tr><th>Table header</th><th>Table header</th></tr>
<tr><td>Table cell 1</td><td>Table cell 2</td></tr>
<tr><td><button type="button" name="OK">Click Me!</button></td>
<td><a href="#">Table cell 4</a></td></tr>
</table>

Then i wrote fallowing code to get the webtable details:

Code:
systemutil.Run("C:\Users\Ramesh\Desktop\testing.html")
With browser("title:=Browser").page("title:=Page")
    obj=browser("title:=Browser").page("title:=Page").webtable("name:=Click Me!").RowCount
    msgbox obj
End With

But I am getting error saying "webtable does not present in OR"
My doubts are like
1. I am writting Descriptive Programming then why it need to store in OR.
2. and Why this error here.
I tried with other webtable properties from object spy also but not working.

Please help me on this.


RE: Webtable - Ankur - 09-01-2013

Your With statement is redundant.

1. I am writting Descriptive Programming then why it need to store in OR.
2. and Why this error here.
>>The propertiy value pair in Your DP statement is worng for Webtable object. Use Object Spy to check which property is QTP using to identify the object.


RE: Webtable - ramesh - 09-02-2013

Thank you ankur... Smile


RE: Webtable - ramesh - 09-03-2013

Hi All I am getting error "Object required" on my below code Please help:

Code:
With browser("title:=testing").page("title:=.*")
TableRowCount=.webtable("name:=name","x:=12").RowCount    
TableColumnCount=.webtable("name:=name","x:=12").ColumnCount(1)
    For i=1 to TableRowCount step 1
        For j=2 to TableColumnCount step 1
            Set ChildObjects=.webtable("name:=name","x:=12").ChildItem(i,j,"link",0)    
                        msgbox ChildObjects.GetROProperty("Name")
        Next
    Next    
End With

Below is my webtable code and i want all the link except 1st column

Code:
<table name="Webtable" border="1">
<tr><th>Header1</th><th>Header2</th></tr>
<tr><td>Table cell 1</td><td><table border="1">
                <tr><td>Name:</td><td><input type="text" name="name"></br><input type="text" name="name"></td></tr>
                <tr><td>Address:</td><td><input type="text" name="address"></td></tr>
                <tr><td>Select one:</td><td><select name="combo1">
                            <option>abcd</option>
                            <option>abcd1</option>
                            <option>abcd2</option>
                            <option>abcd3</option>
                            <option>abcd4</option></select></td>
                </tr>
                </table></td>
</tr>
<tr><td><button type="button" name="OK4">Button4</button><a href="#" name="link1">Table cell_123</a></td><td><a href="#" name="link1">Table cell 4</a></td></tr>
<tr><td><button type="button" name="OK5">Button5</button><a href="#" name="link1">Table cell_432</a></td><td><a href="#" name="link2">Table cell 4</a></td></tr>
<tr><td><select name="combo1">
        <option>abcd</option>
        <option>abcd1</option>
        <option>abcd2</option>
        <option>abcd3</option>
        <option>abcd4</option></select></td>
<td><button type="button" name="OK6">Button6</button></td></tr>
</table>

Thanks in advance