Modify

#1985 closed Bug (Fixed)

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

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

Description

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")
 Send("C:\myfile.txt")

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

I tried version 3.3.6.1 and beta 3.3.7.14

Attachments (0)

Change History (2)

comment:1 by Valik, on Sep 26, 2011 at 5:28:01 PM

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 by Valik, on Sep 26, 2011 at 5:41:54 PM

Milestone: 3.3.7.18
Owner: set to Valik
Resolution: Fixed
Status: newclosed

Fixed by revision [6250] in version: 3.3.7.18

Modify Ticket

Action
as closed The owner will remain Valik.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.