Gowrisankar Posted April 6, 2017 Posted April 6, 2017 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.
Danp2 Posted April 6, 2017 Posted April 6, 2017 Please show us what you've attempted thus far. Latest Webdriver UDF Release Webdriver Wiki FAQs
Gowrisankar Posted April 6, 2017 Author Posted April 6, 2017 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().
Floops Posted April 6, 2017 Posted April 6, 2017 Does this work for you? While 1 _IELoadWait($oIE_SL_CA, 0, 300000) ; Timeout Value in milliseconds If Not @error Then ExitLoop WEnd
Gowrisankar Posted April 6, 2017 Author Posted April 6, 2017 Hi Floops.. I will try it and let you know in few minutes.
Gowrisankar Posted April 6, 2017 Author Posted April 6, 2017 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
Danp2 Posted April 6, 2017 Posted April 6, 2017 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. Latest Webdriver UDF Release Webdriver Wiki FAQs
Gowrisankar Posted April 6, 2017 Author Posted April 6, 2017 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?
Floops Posted April 6, 2017 Posted April 6, 2017 (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 April 6, 2017 by Floops
Gowrisankar Posted April 6, 2017 Author Posted April 6, 2017 It works great now Floops. Thanks a lot...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now