Jump to content
Sign in to follow this  

Modal form in IE

Recommended Posts



I've been working on a project to get our payment screen automated and have made great progress thanks to the AutoIt community. However, I've hit another obstacle which I'm hoping you guys (and girls) can help me with. Basically, having logged into the system and completing page 1 of the form using AutoIt, I'm presented with a modal form that has about 10 fields on it which are mandatory. I've been reading similar posts that bascially say that a modal form cannot be referenced the same way a IE screen can be, is this true? i.e. it sounds like the good old _IEAttach() isn't going to work. If this is the case how do I reference it?

Unfortunately, because the form is modal I can't even scan it with the DebugBar application to scan it's controls, so I'm really stuck.

Can you great people help me out?


Share this post

Link to post
Share on other sites

There are two types of popups... one is IE, the other is Win32. Use the AutoIt Windows Info tool... if the control type is InernerExplorer_server, then it is an IE window and you can attah to it with _IEAttach dialogbox (or embedded). If it is not, then use the standard AutoIt Win* and Control* functions.


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

Share this post

Link to post
Share on other sites

Hi Dale,

Thanks for the tip. Could you please give me examples of the code to create the attachment? So I've done the following, but this hasn't done anything.

$oIE = _IEAttach("Enter The Payment Details -- Web Page Dialog", "DialogBox")
$oCardNum = _IEFormElementGetObjByName($oIE, "cardnumber")
_IEFormElementSetValue($oCardNum, "01462474848")

I've used the forms Title bar text as the "$s_string" parameter.

Also, would you happen to know how to obtain the names of the available fields? Unfortunately, being a modal form prevents DebugBar from working.


Share this post

Link to post
Share on other sites

I had something that might be similar happen only yesterday but this was with a login dialog. Thread is here. At the bottom of the thread is the solution based on Dales advice if its not a dialog.


Use the AutoIt Windows Info tool to determine the type of dialog as Dale already mentioned. Just in case you're not familiar with it this, its in the start menu group for auto-it. Just run it and click on the modal window then check the results in the auto-it windows info tool to determine what you are dealing with.

The individual field names will be named something like edit2, edit3 and so on if its win32. Again you will see this in the info tool.

I hope thats some help.

Edited by machalla

Share this post

Link to post
Share on other sites

Here's info from the Info tool..

>>>> Window <<<<
Title:  Enter The Payment Details -- Web Page Dialog
Class:  Internet Explorer_TridentDlgFrame
Position:   385, 324
Size:   510, 345
Style:  0x96CC0000
ExStyle:    0x00000101
Handle: 0x00340218

>>>> Control <<<<
Class:  Internet Explorer_Server
Instance:   1
ClassnameNN:    Internet Explorer_Server1
Advanced (Class):   [CLASS:Internet Explorer_Server; INSTANCE:1]
Position:   0, 0
Size:   502, 291
ControlClick Coords:    416, 86
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x001A0240

>>>> Mouse <<<<
Position:   805, 440
Cursor ID:  2
Color:  0xE7EFF7

>>>> StatusBar <<<<
1:  http://******/*******/Payments/EnterPaymentDetailsHost.aspx
2:  Local intranet

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

It won't highlight any the text boxes or buttons. I've just discovered the method being called in the parent form is using the window.showModalDialog. Does this also mean that AutoIt no longer has control?

Edited by IndyUK

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
Sign in to follow this