Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repeating If loop
#5
Solved: 11 Years, 3 Months, 4 Weeks ago
Thx Parminder,

I do not get an error, but ...

First,
I changed my code. The first If stement (when no data is retevied) works fine. But the second If statement Still goes to fail even though data is present on the page. I get a warning stating that

Warning or Fail
"If Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebElement("No Results Found").GetROProperty("visible") = True Then" is not found.

My code gives me a warning or fails when WebElement("No Results Found") is not found. My goal is to check if the WebElement("No Results Found") is displayed, if it is then use today's date minus one day. Then check again if WebElement("No Results Found") is visible.

But if WebElement("No Results Found") is not visible (as data is present), my code still marks as Fail.

How can I better check for the message ("No Results Found")? and continue if not found.

Second,
My date code:
TodayDate = DateAdd("d",-1,Now())
eDate = FormatDateTime(TodayDate,2)

returns 7/1/2011, but this fails as the program only alows mm/dd/yyyy (so, Im need 07/01/2011) or I get an error message.

My code:

Code:
CurrentRow =  DataTable.GlobalSheet.GetCurrentRow
ACCT = Datatable("ACCT1", dtGlobalSheet)
ENV = Datatable("ENV", dtGlobalSheet)

If Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebElement("No Results Found").GetROProperty("visible") = True Then
      'No data found for EndDate in ENV
       eDate = DateAdd("d",-1,Now())
      eDate = FormatDateTime(eDate,2)
        'Try secondary End Date (Today minus 1 day)
      Browser("Wisdom").Page("Wisdom IA").Frame("parent").Image("button_newsearch").Click
      Browser("Fax Request").Page("Preferences").WebEdit("EndDate").Set eDate
      Browser("Fax Request").Page("Preferences").WebElement("SearchPrefPage").Click
      If Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebElement("No Results Found").GetROProperty("visible") = True Then
         Reporter.ReportEvent micFail,"No Data found for Row:  " & CurrentRow & " The Account Number: " & ACCT & " in the ENV: " & ENV & " - has no Data."
         ExitTest
      Else
      'data found for EndDate in ENV
      Reporter.ReportEvent micPass, "Data found for Row:  " & CurrentRow & " The Account Number: " & ACCT & " in the ENV: " & ENV & " - has Data."
      End If
Else
      'data found for EndDate in ENV
      Reporter.ReportEvent micPass, "Data found for Row:  " & CurrentRow & " The Account Number: " & ACCT & " in the ENV: " & ENV & " - has Data."
End If
Reply


Messages In This Thread
Repeating If loop - by mv8167 - 06-30-2011, 11:06 PM
RE: Repeating If loop - by parminderdhiman84 - 06-30-2011, 11:17 PM
RE: Repeating If loop - by mv8167 - 06-30-2011, 11:34 PM
RE: Repeating If loop - by parminderdhiman84 - 06-30-2011, 11:45 PM
RE: Repeating If loop - by mv8167 - 07-01-2011, 06:59 PM
RE: Repeating If loop - by rajpes - 07-04-2011, 05:27 PM
RE: Repeating If loop - by mv8167 - 07-06-2011, 12:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  FOR LOOP shayk1985 1 5,301 12-13-2012, 11:35 AM
Last Post: sams001
  How to exit from a for loop silpavinod 2 9,873 10-17-2012, 12:55 AM
Last Post: agarwl.anurag
  for loop sia sharma 1 3,340 09-13-2012, 11:44 AM
Last Post: ksrikanth2k9
  Help with Loop LJENNE 1 3,186 08-10-2012, 12:32 PM
Last Post: Ankesh
  How to get out of infinite FOR loop... sssidana 3 4,560 07-20-2012, 01:04 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 2 Guest(s)