Opened 13 years ago

Closed 12 years ago

#1985 closed Bug (Fixed)

_IEAction($element, "focus") does not work in IE9

Reported by: anonymous Owned by: Valik
Milestone: Component: AutoIt
Version: Severity: None
Keywords: ie9, ie.au3, focus Cc:


Please try the following script to reproduce (extracted from the help file)

#include <IE.au3>
$oIE = _IE_Example("form")
 $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
 Local $oInputFile = _IEFormElementGetObjByName($oForm, "fileExample")
; Assign input focus to the field and then send the text string
 _IEAction($oInputFile, "focus")

As you can see the example fails in IE9, but it works in IE8

I tried version and beta

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Valik

This is not an AutoIt bug, this is a change in behavior for IE9. If an about URI (for example: about:blank) is displayed then IE9 tries to be "helpful" and gives focus to the URL bar. The fix for this is simple:

Local $oDocument = $oIE.document
_IEAction($oDocument, "focus")

This will give focus to the document and take it away from the browser frame. You can then follow that up with a call to _IEAction(..., "focus") to set focus to your desired element.

I will update the documentation example(s) to do this automatically. When this ticket is marked as "fixed" it will be the documentation that is fixed since this is not an AutoIt bug.

comment:2 Changed 12 years ago by Valik

  • Milestone set to
  • Owner set to Valik
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [6250] in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Valik.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.