Jump to content

IE9 Automation Problems


kevingy
 Share

Recommended Posts

  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The embedded browser object returns "WebBrowser", the full IE instance returns "IWebBrowser2", so there is at least a need for both of those. I don't know about "IWebBrowser", but it may be the string returned by a browser earlier than IE7 which is the oldest I have to test with at the moment.

The two are needed, the third, maybe not but without testing older browsers I'd say leave it in, no harm.

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

I must say that I'm shocked by some testing I just did. I fully expected the "Click" issue some have reported in IE9 that works in compatbility mode, but not in standards mode was an IE issue, not an AutoIt issue. My testing shows otherwise.

This VBS code works whether the page is in compatibility mode or not (meaning, the browser displays, the INPUT TYPE=IMAGE element is clicked and you are redirected to a page that says: "Email is A required field. Please use your browser's back button and correct this error."):

set oIE = CreateObject("InternetExplorer.Application")
oIE.visible = 1
oIE.navigate2("http://wdextras.womansday.com/contests_texas.html")
Wscript.sleep 5000

set oB = oIE.document.getElementsByName("submit").Item(0)

oB.click

The following AutoIt code works when the page is in compatibility mode, but NOT in standards mode (meaning it works as above, but the element is not clicked and the page redirect does not occur):

$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.navigate2("http://wdextras.womansday.com/contests_texas.html")
Sleep(5000)

$oB = $oIE.document.getElementsByName("submit").Item(0)

$oB.click

You can place a page into compatibility mode by clicking the broken page icon to the right of the URL, or by using Tools... Compatibility View Settings and adding the site to the list.

Here is another version of the AutoIt code that will demonstrate that the Click event is triggered in compatibility mode, but not in standards mode my writing event information to the console:

$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.navigate2("http://wdextras.womansday.com/contests_texas.html")
Sleep(5000)

$oB = $oIE.document.getElementsByName("submit").Item(0)
$oEvt = ObjEvent($oB, "Evt_")

ConsoleWrite($oB.outerhtml & @CRLF)

$oB.click

Func Evt_($s)
    ConsoleWrite($s & @CRLF)
EndFunc

I have not created a bugtracker case for this yet, because I am not happy with pointing at some page on the Internet and have not created a stand-alone reproducer for the HTML.

Also note: These reproducers do not use IE.au3 and this is NOT an issue introduced in recent betas. The behavior is the same for IE9 with 3.3.6.1 and with 3.3.7.14

Dale

Edited by DaleHohm

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

Ok. This code puts IE.au3 back in the picture to do the attach, but the results are the same - works when in compatibility mode, not in standards mode:

#include <IE.au3>

;$oIE = ObjCreate("InternetExplorer.Application")
;$oIE.visible = 1
;$oIE.navigate2("http://wdextras.womansday.com/contests_texas.html")
;Sleep(5000)
$oIE = _IEAttach("http://wdextras.womansday.com/contests_texas.html", "url")

$oB = $oIE.document.getElementsByName("submit").Item(0)
$oEvt = ObjEvent($oB, "Evt_")

ConsoleWrite($oB.outerhtml & @CRLF)

$oB.click

Func Evt_($s)
    ConsoleWrite($s & @CRLF)
EndFunc

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

There is no [retval].

This should fail:

set oIE = CreateObject("InternetExplorer.Application")
oIE.visible = 1
oIE.navigate2("http://wdextras.womansday.com/contests_texas.html")
Wscript.sleep 5000

set oB = oIE.document.getElementsByName("submit").Item(0)

'msgbox TypeName(oB)


WrongThingToDo = oB.click

Is it?

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I'm not certain I know what you are asking, but the .click method does not have a return value. See MSDN: http://msdn.microsoft.com/en-us/library/ms536363.aspx

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

Oh, OK. You're right - it fails in Standards mode, but not in compatibility mode. Why?

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

Probably because compatibility excludes certain checks normally done inside methods.

This issue was already addressed only using different/wrong logic because there was no way to do the testings. It was an assumption fix. Now that the cause of failures is detected, it should be easy (real) fix.

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I have not created a bugtracker case for this yet, because I am not happy with pointing at some page on the Internet and have not created a stand-alone reproducer for the HTML.

Also note: These reproducers do not use IE.au3 and this is NOT an issue introduced in recent betas. The behavior is the same for IE9 with 3.3.6.1 and with 3.3.7.14

Dale

Here is a reproducer. It proves that VBS works fine with the "build on the fly" page, but Autoit fails to click when running in IE9 mode and "DocType" is included.

If DocType is missing or IE8 mode is on, AutoIt click works fine.

Just let the code run and play with different answers.

Global $oIE
Global $filenameHTML = @ScriptFullPath & ".~temp~.HTML"
Global $filenameVBS = @ScriptFullPath & ".~temp~.VBS"
OnAutoItExitRegister("_exit")
Func _exit()
    If MsgBox(4 + 32 + 262144, "End of IE9 Test", @LF & "Do housekeeping (delete temp files)?" & @LF, 0) = 7 Then Exit
    FileDelete($filenameHTML)
    FileDelete($filenameVBS)
    If IsObj($oIE) Then $oIE.quit
EndFunc   ;==>_exit

$html = ''
$answer = MsgBox(4 + 32  + 262144, "IE9 Test",  @LF & "  Insert 'DOCTYPE' tag as first line in HTML code ? " & @LF & @LF & "  If    YES   , the 'click-failure' will occour in AutoIt IE9 mode." & @LF & @LF &"VBS Test will pass even with Doctype included", 0)
If $answer = 6 Then
    $html &= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
EndIf
$html &= @CRLF & '<HTML><HEAD><TITLE>IE9 Test</TITLE></HEAD><BODY><div align="center">'
$html &= @CRLF & '<H1>&nbsp;</H1><H1>Click on the image.</H1><H1>&nbsp;</H1>'
$html &= @CRLF & '<input onClick="alert(' & "'" & 'Bingo. Image has been clicked.' & "'" & ');" name="Submit" value="Submit" '
$html &= @CRLF & ' src="http://www.autoitscript.com/forum/public/style_images/autoit/logo.png" type="image">'
$html &= @CRLF & '</div></BODY></HTML>'
$filehandle = FileOpen($filenameHTML, 2)
FileWrite($filehandle, $html)
FileClose($filehandle)
$vbs = 'set oIE = CreateObject("InternetExplorer.Application")'
$vbs &= @CRLF & 'oIE.visible = 1'
$vbs &= @CRLF & 'oIE.navigate("' & $filenameHTML & '")'
$vbs &= @CRLF & 'Wscript.sleep 500'
$vbs &= @CRLF & 'set oB = oIE.document.getElementsByName("submit").Item(0)'
$vbs &= @CRLF & 'msgbox TypeName(oB)'
$vbs &= @CRLF & 'oB.click'
$vbs &= @CRLF & 'msgbox "After click."'
$vbs &= @CRLF & 'oIE.quit'
$vbs &= @CRLF & ''
$filehandle = FileOpen($filenameVBS, 2)
FileWrite($filehandle, $vbs)
FileClose($filehandle)
ShellExecuteWait($filenameVBS)

MsgBox(262144,"IE9 Test",@lf & "End of VBS Test and start of AU3 Test." & @lf,0)
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.navigate2($filenameHTML)
WinWait("IE9 Test", "", 10)
MsgBox(64 + 262144, " IE9 Test", @LF & "Breakpoint to enter IE8 mode, if desired." & @LF & "Press F12 in browser window and select browsermodus in menubar.", 0)
$oSubmit = $oIE.document.getElementsByName("submit").Item(0)
MsgBox(262144, "Is Object ?", "IsObj ? " & IsObj($oSubmit) & @LF, 0)
Global $eventfired = 0
$oEvt = ObjEvent($oSubmit, "Evt_")
$oSubmit.click
MsgBox(262144, "", @LF & "Event has fired ? " & $eventfired, 0)
Exit

Func Evt_($s)
    $eventfired = 1
    MsgBox(262144, "", @LF & "Event fired: " & $s, 0)
EndFunc   ;==>Evt_

There is no #include <IE.AU3>. Dale's UDF is not in question.

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

@forumer100, thanks.

@trancexx, why does requesting a return value from the .click method in vbs cause it to fail? I have always thought doing that would be innocuous.

Dale

Edited by DaleHohm

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

@trancexx, why does requesting a return value from the .click method in vbs cause it to fail? I have always thought doing that would be innocuous.

Dale

Because IDispatch's Invoke is called differently.

For some reason (wrapper implementation I guess) object's Invoke checks how it's called and fails if not the way it should. Seems this check is omitted when compatibility mode is on.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

  • 2 weeks later...

Some websites are written for older IE. Instead of admitting that older IEs were weird, they just say that there's a compatibility issue.

So it is up to the owner to update their site to be compatible with IE 9 and if so will Autoit work with the updated sites (IE 9+) or will we still be forced into compatibility mode

Edited by SkellySoul
Link to comment
Share on other sites

Does the bug still exist in 3.3.7.14?

$oIE = ObjCreate('InternetExplorer.Application')

$oIE.visible = 1

$oIE.navigate('https://secure5.jihsun.com.tw/JssFHCTrade/Asp/Secure/FutureLogin.asp')

MsgBox(0, 'Debug', 'Click When Browser Document Load Complete')

MsgBox(0, 'Debug', $oIE.document.body.innerHTML)

---

AutoIt Error

MsgBox(0, 'Debug', $oIE.document.body.innerHTML)

MsgBox(0, 'Debug', $oIE.document^ ERROR

Error: The requested action with this object has failed.

Link to comment
Share on other sites

Yes, the bug still exists in 3.3.7.14 - and also for focus().

Here is a very small reproducer taken directly 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")
Link to comment
Share on other sites

  • 2 months later...

Hi All,

Just wanted to know if this fix for IE9 issue has been rolled out to users. What version of AutoIt has this fix? Please let us know.

Thanks for all your help! I have been using AutoIt lately and i love it. I plan to be an active member and contribute as much possible.

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