Jump to content

why a "modal" web popup windows stops my script?


Go to solution Solved by jdelaney,

Recommended Posts

HI

I am using IE.au3 to automate a web application.

at one point of the script, a strange behaviour occurs as follow:

I use the following code to wait that an object exists:

Do ; waiting that an object is generated (by javascript or ajax)
    Local $oPseudoButton = _IEGetObjById($oFrame,"button6_ManageDtls")
    ConsoleWrite(".") ; to see that script is going on
    Sleep(250) ; give some time to build
Until IsObj($oPseudoButton)

ConsoleWrite(@CRLF&"Button exist"&@CRLF) ; OK button now exist

_IEAction ($oButton, "click") ; here a new modal window is opened
                
                ; and script stop untill the modal windows will be closed

ConsoleWrite("The end")  ; only after the modal windows is closed this line is executed

but after that the click is performed by the _IEAction ($oButton, "click") statement
a new modal windows is opened with a web page inside;

the script stops in this point (line 18) and do not goes on until the modal windows is closed,

avoiding my script to do any further action.

is it normal that a modal windows stops the script?

how to free up the script from this strange interruption?

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Start a second script to wait, and close the popup, or start a second script to click what causes the window to open, so the current script can close the win.

I think you can also focus, and do a controlsend with enter to get around that.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thanks jdelaney
my purpose is not to close the modal window, instead I want to _IEAttach() to it so to be able manage it's content,

but the "strange" stop of the script prevents it to be done.

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

  • Solution

Yeah, that happens with window controls too...something about the click initiates something, and waits for a callback (script waits), which doesn't occur until the popup is closed.  Sounds like you should go the route of sending the 'click' through a second process, so you can interact with the popup

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Yeah, that happens with window controls too...something about the click initiates something, and waits for a callback (script waits), which doesn't occur until the popup is closed.  Sounds like you should go the route of sending the 'click' through a second process, so you can interact with the popup

 

so, I should call another script that performs the _IEAction ($oButton, "click") while the "main script" should flow regularly?

how to call a second script?

I think i have to compile it

I will give it a try

are not there other simpler workarounds?

I would like to use and remain in the same script

 

Edited by Pincopanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

After some tests to resolve the problem within the same script, I gave up and followed jdelaney's advice in post #4 in this way:

from the main script, i call a compiled script that performs in turn the action of clicking on the main form, opening the modal window, so the main script doesn't stop and statements that follows are executed normaly

From the main script:

Run("Click_For_Me.exe")
; instead of _IEAction ($oButton,"click")

This is the source of the compiled script:

#include <IE.au3>

;  attach to main web page already opened by the main script
$oIE = _IEAttach("BMC Software")

; reference to the Frame
Local $oFrame = _IEFrameGetObjByName($oIE, "main-frame")

; reference to the button within the frame
Local $oButton = _IEGetObjById($oFrame,"ManageDtls")

; performs the click on that button
; that will open the modal windows
_IEAction ($oButton,"click")

anyway I still do not understand why this strange problem occurs, i think that autoit should handle this situations. Is it an autoit bug?

Edited by Pincopanco

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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...