Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
6 years ago

condition of Delay method if there are chance of exist two different pages in automation

In the below i am trying to call delay for two different pages, if any one of them will exist it should be work but i am getting error when declaring object2.Exists = True.... Please help

 

 

Function callDelay(time,PropertyName, KeyValue, TagName)
Dim counter
'Delay Function using Counter Applied for PageLoading and calling home page .
Set page = Sys.Browser("*").Page("*")
Do
aqUtils.Delay 1000
Set object 1 = page.NativeWebObject.Find(PropertyName, KeyValue, TagName)

Set object2  = page.NativeWebObject.Find(PropertyName, KeyValue, TagName)
counter = counter+1
Loop Until object1.Exists = True or object2.Exists = True or counter >= time

If counter >=time then
       Log.Error("Page can not be loaded......")
       counter=0
       page.FindChildByXPath("//a[@href='login.htm']").Click
Else
       Log.Message("Time taken to : "&object.contentText&" "&counter&" Seconds")
End If
End Function

7 Replies

  • baxatob's avatar
    baxatob
    Community Hero

     

    Set page = Sys.Browser("*").Page("*")

     

    The code above will recognize ANY page. If you have two pages, the Find() method will always work on the first page, that was found in the ObjectBrowser tree.

     

    You need to recognize the proper page before you run any methods their.

    • kaiiii's avatar
      kaiiii
      Regular Contributor

      What method i can use in place of Find() Method so that, i can make a logic to search both object on different pages

      • baxatob's avatar
        baxatob
        Community Hero

        Find() method is good enough. 

         

        Can you describe your test case step by step? We'll try to find a solution.