Jump to content

[Solved] What is the replacement to _ieloadwait() in UI Automation?


Recommended Posts

 

Edit: Problem solved. See my post 4 entries below.:thumbsup:

I am currently converting a script from internet explorer to google chrome.
Now I'm looking for the replacement for _IELOADWAIT()
My first attempt was

$oWindowPattern1.WaitForInputIdle($iMilliSeconds, $bSuccess)

but unfortunately the script did not wait.

Does anyone has a solution?

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Now I have found a solution. :thumbsup:

Unfortunately, there is a dependency on the German language. ☹️
But my problem is solved.
Here is my solution:

;~  _IELoadWait($oIE)
;~ =============================================================


        ; find "Google Chrome" pane

        Local $pCondition0, $pPane1, $oPane1
        $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Google Chrome", $pCondition0)
        $oWindow.FindFirst($TreeScope_Descendants, $pCondition0, $pPane1)
        $oPane1 = ObjCreateInterface($pPane1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)


        ; Find "Neu laden" Button

        Local $pCondition1, $pButton, $oButton
        $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Neu laden", $pCondition1)
        $oPane1.FindFirst($TreeScope_Descendants, $pCondition1, $pButton)
        $oButton = ObjCreateInterface($pButton, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8)


        ; Get "Neu laden" button description

        Local $sLegacyIAccessibleDescription1
        $oButton.GetCurrentPropertyValue($UIA_LegacyIAccessibleDescriptionPropertyId, $sLegacyIAccessibleDescription1)
        ConsoleWrite("Before reload: $sLegacyIAccessibleDescription1 = " & $sLegacyIAccessibleDescription1 & @CRLF)


        ; reload Window

        ControlSend($hWin, "", "", "^r") ; neu laden
        Sleep(100) ; allow refresh to start


        ; wait for "noload" description
        While $sLegacyIAccessibleDescription1 <> "Seite nicht weiter laden"
            $oButton.GetCurrentPropertyValue($UIA_LegacyIAccessibleDescriptionPropertyId, $sLegacyIAccessibleDescription1)
            Sleep(20)
        WEnd
        ConsoleWrite("During reload: $sLegacyIAccessibleDescription1 = " & $sLegacyIAccessibleDescription1 & @CRLF)
        ; wait for "load complete" description
        While $sLegacyIAccessibleDescription1 <> "Diese Seite neu laden"
            $oButton.GetCurrentPropertyValue($UIA_LegacyIAccessibleDescriptionPropertyId, $sLegacyIAccessibleDescription1)
            Sleep(20)
        WEnd
        ConsoleWrite("After  reload: $sLegacyIAccessibleDescription1 = " & $sLegacyIAccessibleDescription1 & @CRLF)

;~  end of _IELoadWait($oIE) sollution
;~ =============================================================

And here's the console output:

Before reload: $sLegacyIAccessibleDescription1 = Diese Seite neu laden
During reload: $sLegacyIAccessibleDescription1 = Seite nicht weiter laden
After  reload: $sLegacyIAccessibleDescription1 = Diese Seite neu laden

 

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...