Gowrisankar

Relaunching IE and navigate to a URL when loading takes more time

11 posts in this topic

#1 ·  Posted

Hello everyone,

When I launch a URL and the webpage takes more time to load (say more than 1 minute), I want the URL to be relaunched.

I used _IELoadWait(). But the control doesn't get pass through the _IELoadWait() command, since the webpage takes more time to load.

I searched some of the older posts related to this topic. But I couldn't work them out.

Please guide me.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Please show us what you've attempted thus far.

Share this post


Link to post
Share on other sites

#3 ·  Posted

Sure Danp2.

Global $oIE_SL_CA = _IECreate()
_IENavigate($oIE_SL_CA, "---URL-HERE---")
_IELoadWait($oIE_SL_CA)

The IE window is just passive for long time. But the webpage was not loaded.

I tried the following code after the _IELoadWait()

Local $sStatusMessage = _IEPropertyGet($oIE_SL_CA, "statustext")
MsgBox(0, "Information", $sStatusMessage)

The status text was not displayed since the control didn't get past _IELoadWait().

Share this post


Link to post
Share on other sites

#5 ·  Posted

Hi Floops.. I will try it and let you know in few minutes.

Share this post


Link to post
Share on other sites

#6 ·  Posted

I tried the following code with time out value as 10 seconds. But the message box I have coded below was displayed only after several seconds when the webpage was completely loaded.

While 1

      _IELoadWait($oIE_SL_CA, 0, 10000) ; Timeout Value in milliseconds

      MsgBox(0, "Information", "ReLaunching")

      _IENavigate($oIE_SL_CA, "---URL-HERE---")

      If Not @error Then ExitLoop

   WEnd

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

That's how it is supposed to work. The call to _IELoadWait will return when either the page has completely loaded or the timeout has occurred.

Share this post


Link to post
Share on other sites

#8 ·  Posted

I think the timeout was not considered.

Only after nearly one full minute, the webpage was loaded and the message box was populated.

Is there a way to consider the timeout value alone and relaunch the url when the timeout has occurred?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Try this please

 

#include <IE.au3>

$oIE_SL_CA = _IECreate()

While 1

    _IENavigate($oIE_SL_CA, "https://google.com", 0) ; change the url

    _IELoadWait($oIE_SL_CA, 0, 10000) ; Timeout Value in milliseconds
    If Not @error Then ExitLoop

    MsgBox(0, "Information", "ReLaunching")

WEnd

If the Timeout is reached the _IELoadWait Function returns an error.

The script only exits the loop if there is no error, aka the site loading successfully.

Edited by Floops

Share this post


Link to post
Share on other sites

#10 ·  Posted

It works great now Floops.

Thanks a lot... 

Share this post


Link to post
Share on other sites

#11 ·  Posted

You're welcome :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • Spask
      By Spask
      Hi, I'm trying to find a text value inside of a html.
      This is what the line looks like normally:
      <p id="line1" class> <span class="bot">TEXT HERE</span> </p> The text then changes to a non breaking space:
      <p id="line1" class> <span class="bot">&nbsp;</span> </p> And then it changes back to normal text but it's different every time.
      Can I code this so that it grabs the text every time it changes and has a variable that represents it?
      I currently have this inside of my loop:
      $span = .document.getElementsByTagName("span") For $text In $span If $text.value = "&nbsp;" Then Sleep(50) MsgBox(0,0,0) ;messagebox to test if it can be found, but I don't know how to grab the text EndIf Next The problem is that there are many other lines in the html that have the same span but are called "line3", "line5", etc and the one I need is from "line1".
      I will appreciate if anyone can help with this!
    • sree161
      By sree161
      Hi,
      i have a code which generates two numeric outputs.i have to save them in excel.
      Is there any way to export them to specific cells in excel???
    • electrons
      By electrons
      hi  , hope  you all doing well 
       cant find any elements on the page ?  and the right click mouse dont work too?
      iam trying with more than method , i need help please!!
       

    • ur
      By ur
      I have kept below line to wait for IE to load the site completely and continue.
      _IELoadWait($oIE)
       
      But, the code is continuing without waiting for it and I my execution is failing as the elements are not loaded completely.

       
      Any suggestions for alternate code to wait for the browser to load completely?
       
    • ur
      By ur
      We can select elements in IE using their IDs as below.
      Local $oDiv = _IEGetObjById($oIE, "x-auto-16-input") But to one button in the webpage, there is no ID to it.
      In selenium we have option to select this element using the CssSelector and clicked the button using below code in c# selenium.
      driver.FindElement(By.CssSelector("button.x-btn-text")).Click(); What is the alternative for this in AUtoIT?