Forum Discussion

vinodtc's avatar
vinodtc
Contributor
15 years ago

How to wait for new url/page, until get reflect by not using static delay times?

Hi,


We are using the DOM Model to identify the objects in UI. As the url is changing every time, what we have done is we are taking current URL from the Browser url location i.e

Url1= Sys.Process("IEXPLORE").IEFrame(0).Window("WorkerW", "Navigation Bar", 1).Window("ReBarWindow32", "", 1).Window("Address Band Root", "", 1). wText.


 a

nd sending this “Url1”while writing the code. i.e

 

Str1=Sys.Process("IEXPLORE").Page(Url1).document.all.Item("HTML").innerText


Also we are using static delay time to stop execution of script until page url chaging

aqUtils.Delay 5000


So my final code would be like this.

---------------------


If Sys.Process("IEXPLORE").Page(url1).document.all.waitItem(ButtonID,1000).Click() then

    Sys.Process("IEXPLORE").Page(url1).document.all.Item(ButtonID).Click()

End if

aqUtils.Delay 5000

Url1= Sys.Process("IEXPLORE").IEFrame(0).Window("WorkerW", "Navigation Bar", 1).Window("ReBarWindow32", "", 1).Window("Address Band Root", "", 1). wText.

Sys.Process("IEXPLORE").Page(url1).wait()

Str1=Sys.Process("IEXPLORE").Page(url1).document.all.Item("HTML").innerText


---------------------

Perform some action like “ Cick on Login Button” -> This will lead to new page and that new page url get reflect in browser url location after some time. So we have used delay time. This delay time is varies from time to time.


My question is, how to wait for new url/page, untilget reflect by not using static delay times.


I have tried by using “waitPage”,But this require new url. To get this new url I have wait for some time. Again I have to use some constant delay timings. Please help us to overcome this issue.



Regards,

Vinod

3 Replies

  • Hi  Alex,



    As you suggest, i can use ToUrl or
    NavigateTo
    methods when i am accessing my product url first time. After that when I am doing some actions on product, it is redirecting to other urls. This redirection will take radom time to load the page. To maintain the synchronization I am using constant delay timings.



    I don't want to user constant delay timings. As and when page loads, next action should be performed on loaded page. Please suggest the solution.



    if you update the above code with solution and sent to us, its very useful.





    Regards,

    Vinod
  • Hi vinod,



    My question is, how to wait for new url/page, untilget reflect by not using static delay times.


    First of all, try using the advice from the "Waiting For Page" help topic.



    I have tried by using "waitPage",But this require new url.


    Try using wildcards when specifying the first parameter of the method.