Jump to content
ur

_IELoadWait not working

Recommended Posts

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.

Untitled.png

 

Any suggestions for alternate code to wait for the browser to load completely?

 

Share this post


Link to post
Share on other sites
JLogan3o13

How about a runnable reproducer to show the issue?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
ur

It is from local server page... 

So I think we can't replicate the complete environment here.

But here is the part of code.

 

#include <IE.au3>

#include <Date.au3>
#include <file.au3>


Global $IE,$sBaseURL, $oIE, $mart_IE_user, $mart_IE_password, $mart_IE_email
$IE = ""
$sBaseURL = "http://localhost:18170/"

initIE()

Func initIE($luser = "uday", $lpassword = "password" , $lemail = "robot@test.com")
   $mart_IE_user = $luser
   $mart_IE_password = $lpassword
   $mart_IE_email = $lemail

   $IE = _IECreate("http://www.autoitscript.com/forum/index.php?")
   $oIE = _IEAttach ("", "instance",1);selects ie first instance opened.
   _IEPropertySet($oIE,"Height",@DesktopHeight)
   _IEPropertySet($oIE,"Width",@DesktopWidth)

   gotoMartPage()
   processMart()
   Logging("Completed executing Mart Login and delete process through IE.")
   if _IEQuit($oIE) = 1 then
      Logging("exited IE browser..")
   Else
      Logging("unable to exit IE browser..")
   EndIf
EndFunc
Func gotoMartPage($page = $sBaseURL & "MartAdmin")
   _IENavigate ($oIE, $page)
   _IELoadWait ($oIE)
   Logging("Completed gotoMartPage with page : "&$page)
EndFunc

Func processMart()
   $title = _IEPropertyGet($oIE, "title")
   if not StringCompare($title,"erwin Mart Administrator")=0 then
      ;MsgBox(0,"Page not loaded with heading: ","erwin Mart Administrator")
      Logging("Error: Page Not loading with Heading - erwin Mart Administrator");-------Coming to this line------
      Exit;
   Else
      ;--REmaining part----
   EndIf
EndFunc


Func Logging($sMessage,$sLogFile=@ScriptDir&"\Logging.log")
    If $sMessage = "" Then
        FileWriteLine($sLogFile, "")
    Else
        FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF)
    EndIf
EndFunc

Logging("Error: Page Not loading with Heading - erwin Mart Administrator");-------Coming to this line------

Edited by ur

Share this post


Link to post
Share on other sites
Danp2

Just guessing, but the site is probably loading some dynamic content even after the browser thinks the page has finished loading. One way to deal with this is to continuously loop until a designated element is found. Here's a prior thread where this technique is discussed.

 

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

    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

    • SkysLastChance
      By SkysLastChance
      I am trying to type a name in patient summary search box. How should I go about doing this. I am clearly not doing it right. (Attached Picture of HTML code.)
      This is what I have tried. I assume this is not working because it is not a form? 
      WinActivate("MEDITECH - Internet Explorer")       Sleep (500)    $oIE = _IEAttach("MEDITECH")    $oForm = _IEFormGetObjByName($oIE, "systemMenu")    $oText = _IEFormElementGetObjByName($oForm, "sysmenu-searchbarinput") _IEFormElementSetValue($oText, "Hey! This works!")
    • aiter
      By aiter
      Just want to report a warning I get when using IE udf and running from F5 in scite

      -> IE.au3 T3.0-2 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
      When I look at IE.au3 I see a comment that this function has been removed as there are no more fatal errors.
       
    • aiter
      By aiter
      I created a webpage using the IE udf. Great, but then I noticed I cannot do a ctrl-F to find something on the page. 
      If I save the page then bring that page up I can find things of course.
      Its trivial really, but is there way to get the ctrl-F to work when the page is generated without resorting to having to save?
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.