Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NEED help with scripting. Web table, Click Link
#1
Not Solved
Could you help me with the following issue, please.

I have à dynamic web table that contains web elements and à link. What i would like to do is check if the data in the globalsheet matches à row in the web table and if so then click on the link. The table looks like the exemple below.

In the Globalsheet I have the Product, Price and OrderDate.
So if the Prodt ZJK with Price 15 and Orderdate 1-6-2012 than click on the OrderNr. The name of the webtable is OrderNrs and the ZKL 15, 1-6-2012 are all web elements

OrderNr Product Price OrderDate ReceivedDateStatus
15 Bonus 1532 7-6-2012 Open
6 ZKL 15 1-6-2012 5-6-2012 Closed
575 Top 111 9-6-2012 Open

Reply
#2
Not Solved
Hi,

Instead of pasting the code, I suggest you to try this on your own and resolve yourself :-)

Make sure Webtable has unique description and QTP identifíes it properly.

Follow the below process:
Retrieve the data from datatable columns i.e. Product, Price & Orderdate...Say these are Expected Product, ExpectedPrice, ExpectedOrderDate.
Find out RowCount of Webtable.
Use a For loop for looping through the Webtable.
Get the cell values from the column 1,2,3(i.e. Product,Price & OrderDate) for each row and validate them with above expected values
Use a simple "If then" statement so that If current row's cell values are matched with above expected values then use "ChildItem" method to click the correspoding link in that row.
Use exit for to exit the For Loop.

Reply
#3
Not Solved
I tryed it and i cann't Fix it.
Could you give me some example's , please
Reply
#4
Not Solved
It is not that simple Sad
Reply
#5
Not Solved
Code:
ExpectedProduct=Datatable("Product",dtLocalSheet)ExpectedPrice=Datatable("Price",dtLocalSheet)
ExpectedOrderDate=Datatable("Ord_date",dtLocalSheet)

RC=Browser(...).Page(..).WebTable(..).RowCount
For i=1 to RC
   Actual_Product=Browser(...).Page(..).WebTable(..).GetCellData(i,2)
   Actual_Price=Browser(...).Page(..).WebTable(..).GetCellData(i,3)
   Actual_OrdDate=Browser(...).Page(..).WebTable(..).GetCellData(i,4)
    If (ExpectedProduct=Actual_Product And ....... And ...... ) Then
           Browser(...).Page(..).WebTable(..).ChildItem(i,1,"Link",0).Click
           Exit for
   End if
Next

Now its your turn to implement accordingly buddy Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Scripting spixol 0 1,469 12-15-2019, 01:14 PM
Last Post: spixol
  Can QTP handle slick grid table in a web page qtplearner88 2 4,472 10-01-2019, 10:44 AM
Last Post: shilpi952
  Child Object Not able to identified in Web Menu Link noor 0 1,834 01-21-2018, 04:44 PM
Last Post: noor
  unable to rowcount in web table manoj84monu 1 2,878 06-13-2016, 04:46 PM
Last Post: Anu1234
  VB scripting Aisha2015 0 2,371 08-07-2015, 02:21 PM
Last Post: Aisha2015

Forum Jump:


Users browsing this thread: 1 Guest(s)