Jump to content

Help regarding Webpage Dialog in IE


MaxEdman
 Share

Recommended Posts

Hello,

I'm quite new in AutoIT programming. And I have a major issue.

When writing a script I need to be able to control an IE Webpage Dialog box. I have tried IEAttach and the Win-commands like WinActivate, but it won't work at all. It seems like AutoIT does not notice the window. I have tried using the "IETitle" but that won't work at all. And There is no way to get the HTML code from this window.

I have tried to use WinActivate("[ACTIVE]") and this returns 1 after I close the dialog box. But it won't execute until the box is closed.

Does anyone now how to solve this problem?

The information I get from the webpage dialog box is;

>>>> Window <<<<
Title: "IETitle" -- Webpage Dialog
Class: Internet Explorer_TridentDlgFrame
Position: 603, 324
Size: 678, 232
Style: 0x96C80000
ExStyle: 0x00000101
Handle: 0x0023077A

>>>> Control <<<<
Class: Internet Explorer_Server
Instance: 1
ClassnameNN: Internet Explorer_Server1
Name: 
Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]

Thanks! :)

Link to comment
Share on other sites

Hi MaxEdman

I guess that the IE Webpage Dialog box stops your main script untill you close that dialog, so you can make not action on that dialog because your script is stopped and waiting the close of the dialogbox.

Can you post the portion of code that you use to open the DialogBox?

EDIT:

yes, I think I had the same problem, if is like your case, I solved it >this way

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

Hi MaxEdman

I guess that the IE Webpage Dialog box stops your main script untill you close that dialog, so you can make not action on that dialog because your script is stopped and waiting the close of the dialogbox.

Can you post the portion of code that you use to open the DialogBox?

EDIT:

yes, I think I had the same problem, if is like your case, I solved it >this way

The second example for _IEAttach in the helpfile gives a solution that does not require the separate script.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hi Dale, thanks for your post

the problem occurs before you can use _IEAttach().

the problem indicated by OP is the same one that occurred to me, and probably is caused

by the problematic popup that has the same class name of the one that troubled my script

(Class: Internet Explorer_TridentDlgFrame).

as I said before, the problem occurs before you can use _IEAttach() because the scipt freezes

as soon as the popup is opened (>this is the link of the description of the strange problem)
in short:
1) you perform a click on a link;
(_IEAction ($ OButton, "click"); here the problematic modal window is opened
2) the script at this point does not continue until you close the popup.
3) the only way to continue the script is to manually close the popup (in this way you can not manage the popup content)
4) the problem does not occur if the click on the link is carried out by another script called by the main script.

 

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

further researching in the forum I found >this post where there is also another solution to the problem

here I post a simplified reproducer of the problem extracted from the above link:

1) if you comment out lines 20 and 21 and execute line 23 the problem occurs

    (the problem is that the script freezes and lines following are executed only after the popup is closed)

2) if you comment out line 23 and execute lines 20 and 21 the problem do not arise

#include <IE.au3>
; Open Microsoft's demo page
$sURL = "http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm"
$oIE = _IECreate($sURL)
$hIE = _IEPropertyGet($oIE, "hwnd")

; Click button to open modal popup
$oButton = _IETagNameGetCollection($oIE, "Button", 0)

; the following 2 lines to not freezes the script
 If @error = 0 And IsObj($oButton) Then _IEAction($oButton, "focus")
 ControlSend($hIE, "", "", "{ENTER}")

; _IEAction($oButton, "click") ; <--- this statement freezes the script

ConsoleWrite("now script has reached this point" & @CRLF)
; -----------------
$timeout = TimerInit()
Do
    $oPopup = _IEAttach("Text Selection in a Modal Dialog --", "DialogBox")
    If TimerDiff($timeout) > 5000 Then
        MsgBox(0, "Timeout", "Popup not found" & @CRLF & "it was closed")
        Exit
    EndIf
Until IsObj($oPopup)

$TextArea = _IEGetObjById($oPopup, "output")
_IEFormElementSetValue($TextArea, "Hey! This works!")

EDIT: modified 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

I got the script to work through DOM-manipulation by focusing the object instead of clicking, and then sending Enter. This works fine, and I'm able to attach to the new DialogBox. There is one problem though, there are no information about the ids/names or anything else in this window. The popupbox appears to be calling a JavaScript. Is there any way of getting information from this popup? :)

Link to comment
Share on other sites

after you attached the popup you could try to use something like this to get references to objects:

Local $oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
    ConsoleWrite($oElement.tagname & @TAB & "id: " & $oElement.id & @CRLF)
Next

good luck

 

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