Micro Focus QTP (UFT) Forums
Reading Dynamic webtable-WebElement - 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: Reading Dynamic webtable-WebElement (/Thread-Reading-Dynamic-webtable-WebElement)

Pages: 1 2


Reading Dynamic webtable-WebElement - ibmexpert - 05-14-2008

How can I read Dynamic webtable-WebElement (generated from table)
example:
USD 099-00106-1 (3,194,980.12) 0.00
USD 099-80063-1 179,163.50 0.00
USD 099-81057-1 155.92 0.00

When I use QTP it is naming WebElement as 099-00106-1, 3,194,980.12, 0.00 (Link), 099-80063-1, 179,163.50, 0.00 (Link) and so on


RE: Reading Dynamic webtable-WebElement - surya_7mar - 07-07-2008

Even for a Dynamic web Table, they will maintain some unique properties like name or html id. Get to recognise your webtalbe uniquely.

Then your work is done, you can read the table data using GetCellData Function


RE: Reading Dynamic webtable-WebElement - QADBA - 07-09-2008

I have a similar problem.

On the web page is a number displayed. I have to check the number if it's correct. The Problem is that the number is dynamic:

<div style="height:15px;width:180px;margin-top:45px;font-weight:bold;text-align:right;">16.355 </div>

I don't know how to address the shown number to check wether it is right or wrong (for example a negative number or a number that is too high).

In the object spy the number is visible as a webelement: (e.g. 18.422).

The number is visible in the source code like above, because its a server-side filled variable and there is no name or html id, so i'm not able to adress the number.

Is there another way to solve the problem without a html id?


RE: Reading Dynamic webtable-WebElement - surya_7mar - 07-10-2008

You dont need to identify the WebElement, you have to identify the Parent of the WebElement which is obviously a web table.

Now identify that table with Unique properties and Use GetCellData function to retrieve a value from the Table.

If you have any WebPage let me knwo then i can send you the example.


RE: Reading Dynamic webtable-WebElement - QADBA - 07-10-2008

The page i'm testing is seafight.com . On this web page i've to check the number of online player (displayed in the right upper corner) and the number of registered user right below.


RE: Reading Dynamic webtable-WebElement - ashokghali - 07-10-2008

You can use the below code to get required dynamic values. Hope this helps...

Code:
strCellData = trim(Browser("Seafight.com – Online").Page("Seafight.com – Online").WebTable("Deutsch").GetCellData(2,3))
strSplitData = split(strCellData," ",3,0)
onlineNow =  strSplitData(0)
Registered =  strSplitData(1)

Thank you,
-Ashok G.


RE: Reading Dynamic webtable-WebElement - QADBA - 07-10-2008

Thx for your code. I tried to implement your example, but unfortunately i got a run error, because the object wasn't found in the object repository.
With the aid of the object spy, i tried to get a solution. But with no result.


RE: Reading Dynamic webtable-WebElement - ashokghali - 07-10-2008

You need to add the object WebTable("Deutsch") to ur OR. Follow the below steps...

1.Open Object Repository
2.In the Object repository Window, navigate to Object>Add Objects to Local
3.Place the pointer on the Web Element 'Online'
4.Now Select WebTable("Deutsch") from the 'Object Selection - Add to Repository' window.
5.Then try running the code.


RE: Reading Dynamic webtable-WebElement - QADBA - 07-10-2008

Ahh, i see! Now it works, thank you very much.


RE: Reading Dynamic webtable-WebElement - QADBA - 07-10-2008

Is it possible to add my results to the Test Result (Automation>Result)?
At the moment i'll display a message if e.g. the shown number of registered user is smaller than the number of user who are online.