Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
adding two conditions into a while statement
#1
Solved: 11 Years, 3 Months, 3 Weeks ago Question 
Hi guys,
I have a situation which is giving me a lot of troubles.
I have two conditions to be done, for e.g:
I have a table of e.g. 15 rows and two columns: oRow = 15
also each row have it's text: strText = "textFromRow"
to get the text I am using GetCellData:
Code:
Browser("URL:=" &Environment.Value("baseUrl")).Page("URL:=" &Environment.Value("baseUrl")).WebTable("micclass := WebElement", "class := ledgerAvlb_box_right", "Html Tag := TD", "Text := Sales Ledger (SLC + SLCX).*", "Index:=8").GetCellData("6","1")
-- on the second column I have the values of the names from 1st columns.

the idea is that I need a while statement I think (not sure), where to add the condition:

Code:
'counting the rows
oRow = Browser("URL:=" &Environment.Value("baseUrl")).Page("URL:=" &Environment.Value("baseUrl")).WebTable("micclass := WebElement", "class := ledgerAvlb_box_right", "Html Tag := TD", "Text := Sales Ledger (SLC + SLCX).*", "Index:=8").RowCount

' increasing the value of i to oRow
For i = 0 to i = oRow - 1
' get the data from cell(i) to find if it is the same as we need
    strText = Browser("URL:=" &Environment.Value("baseUrl")).Page("URL:=" &Environment.Value("baseUrl")).WebTable("micclass := WebElement", "class := ledgerAvlb_box_right", "Html Tag := TD", "Text := Sales Ledger (SLC + SLCX).*", "Index:=8").GetCellData(i,"1")
' comparing the data from cell(i)
                ' 1st condition - if it's pass we shouldn't continue the second one
        If strText <> "Less Client account (FIU)" then
                        ' the second condition
            While i <> oRow - 1 Do i = i + 1 Until
                Loop Until strText <> "Less Client account (FIU)"
                    Loop While i <> oRow - 1
                    strText = Browser("URL:=" &Environment.Value("baseUrl")).Page("URL:=" &Environment.Value("baseUrl")).WebTable("micclass := WebElement", "class := ledgerAvlb_box_right", "Html Tag := TD", "Text := Sales Ledger (SLC + SLCX).*", "Index:=8").GetCellData(i,"1")
        Else
                        ' get the value of the second cell from the "Less Client account (FIU)" column
            New_LessClientAccountFIU_Value = Browser("URL:=" &Environment.Value("baseUrl")).Page("URL:=" &Environment.Value("baseUrl")).WebTable("micclass := WebElement", "class := ledgerAvlb_box_right", "Html Tag := TD", "Text := Sales Ledger (SLC + SLCX).*", "Index:=8").GetCellData(i,"2")
            Reporter.ReportEvent micPass, "PASS", "The item '" & strText & "' exists on the screen, and it's value is: '" & New_LessClientAccountFIU_Value & "'!"
        End IF

the conditions are:
the idea is that when 1st condition gets passed (If strText = "Less Client account (FIU)"), than we should get a report message(PASS), if not than it should do i+1 while i=oRow-1 (max nr of rows within the table) and give us an error report message.

what I am doing here inside the code(I am trying to do) is:
count all rows, then to increase row's nr i=1 while the necessary text will be equal with the text from that row and also to do this while maximum times = count nr.

please can anyone help me with that?
Reply
Jump to the post that solved this thread.


Messages In This Thread
adding two conditions into a while statement - by lotos - 09-20-2010, 07:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Uft: Adding a property to all ojects into Repository ProTester 0 1,350 06-09-2017, 12:48 AM
Last Post: ProTester
  adding an object to OR seven 1 2,652 02-17-2014, 02:23 PM
Last Post: basanth27
  How to access webtables without adding into Object Repository ramkumarad 7 9,629 12-30-2013, 07:38 PM
Last Post: Sathiya
  vb script to stop execution of functions if conditions fail visitjaga 1 7,380 12-05-2013, 12:26 AM
Last Post: ravi.gajul
  Adding Visual Relation id via script to new object jcraig26 1 4,101 06-24-2013, 01:26 PM
Last Post: ourhari

Forum Jump:


Users browsing this thread: 1 Guest(s)