Jump to content

IE9 Automation Problems


kevingy
 Share

Recommended Posts

  • Administrators

Exciting. This just worked and gave me "HTMLDocument"

CComPtr<IProvideClassInfo> pClassInfo;
            hr = pDisp->QueryInterface(IID_IProvideClassInfo, (void**)&pClassInfo);
            if (SUCCEEDED(hr))
            {
                // Easy life for getting the interface name <img src='http://www.autoitscript.com/forum/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />
                CComPtr<ITypeInfo> pTypeInfo;
                if (SUCCEEDED( pClassInfo->GetClassInfoW(&pTypeInfo) ))
                {
                    CComBSTR bstrName;
                    pTypeInfo->GetDocumentation(MEMBERID_NIL, &bstrName, NULL, NULL, NULL);

                }
            }

From what I've just read though, this interface is not always present (I think it's mandated for web controls but nothing else). Might do whatever it does manually for other objects (I've just left the old broken code in there for now)

Link to comment
Share on other sites

  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

IE.au3 is the only one that I know of using it, but searching the tree for ObjName will be warranted. I'll test with your exe asap and I'll take care of IE.au3 accordingly.

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

Ah, perfect. Thanks.

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

Just for the records:

3.3.7.8 solves the problem with _ExcelBookClose when running as 64 bit as well:

#include <excel.au3>
$oExcel = _ExcelBookNew()
ConsoleWrite("*" & ObjName($oExcel) & "*" & @CRLF)
_ExcelBookClose($oExcel, 0)
returns:

3.3.6.1 64bit: **

3.3.6.1 32bit: *_Application*

3.3.7.8 64bit: *_Application*

3.3.7.8 32bit: *_Application*

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi Dale,

here is another IE9 problem.

The code below works fine on IE8 but the "click" action does not work on IE9.

Tested with AutoIt 3.3.7.9

#include <IE.au3>

$oIE=_IECreate("http://www.autoitscript.com/site/contact-us/")
$o_Input=FindINPUT("name","si_contact_name")
_IEFormElementSetValue ($o_Input,"TEST")

$o_Submit=FindINPUT("id","fsc-submit")
_IEAction($o_Submit,"click")


Func FindINPUT($InputProperty,$InputPropertyValue)
   $oObjects=_IETagNameGetCollection($oIE,"INPUT")
   For $oObject In $oObjects
   $Property=Execute("$oObject."&$InputProperty)
      If StringInStr($Property,$InputPropertyValue,2) Then
         $Found=1
         ExitLoop
      EndIf
   Next
   If $Found Then
      Return $oObject
   Else
      MsgBox(64,"Result:","No INPUT element with such "&$InputProperty&" value.")
      Return(0)
   EndIf
EndFunc
Link to comment
Share on other sites

After some testing, this is not a problem with IE.au3 or AutoIt directly, but some behaviour has changed in IE9. It is the _IEAction, click that is not producing the expected result. Replacing this with $o_Submit.click takes IE.au3 out of the loop at that point and it still doesn't work as you expect. Putting the page into compatability mode makes everything work as you expect.

There is something unique about that submit button that is messing with .click in IE9. I don't have time to reseach any futher at the moment.

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 have done some testing with my code with the latest beta 3.3.7.10 seams to be working sort of only geting one name from forum that im grabing the info from - I may need to edit the Array grabber I think .....

#include <IE.au3>
#include <Array.au3>
#include <String.au3>
#include <File.au3>
#include <_HTML.au3>

Local $MapsArray[1]
Local $mData = "http://www.harryhomers.org/forum/viewtopic.php?f=89&t=4309" ;Harry Homers Maps

    $oIE = _IECreate($mData, 0, 0, 1, 0)
    $oTags = _IETagNameGetCollection($oIE, "DIV")
    For $oTag in $oTags
        $oData = _IEPropertyGet($oTag, "outerhtml")
        $Check = StringRight($oData, 11)
        If $Check = "</A>.</DIV>" Then
            $ArraySplit1 = StringSplit($oData, ".")
            For $ArrayItem in $ArraySplit1
                $ArrayItem = StringSplit($ArrayItem, "<BR>", 1)
                If $ArrayItem[0] > 1 Then
                    If $ArrayItem[2] > 0 Then
                        $ArrayItem[1] = StringStripWS($ArrayItem[1], 3)
                        _ArrayAdd($MapsArray, $ArrayItem[1])
                    EndIf
                EndIf
                If StringInStr($ArrayItem[1], "</UL>") Then
                    $POS = StringInStr($ArrayItem[1], "</UL>") - 1
                    $String = StringLeft($ArrayItem[1], $POS)
                    $String = StringStripWS($String, 3)
                    _ArrayAdd($MapsArray, $String)
                EndIf
            Next
        Else
        ; Not correct div so ignore
        EndIf
    Next
    _IEQuit($oIE)
    _ArrayReverse($MapsArray)
    _ArrayPop($MapsArray)
    _ArrayReverse($MapsArray)
    _ArrayDisplay($MapsArray, "Map Array Final View")
    sleep(2500)

Any help with this would be usefull

the list/array should look like this

1. baserace_final

2. ruins23

3. low_tram

4. railgun

5. rhineland_bridge_4

6. lighthouse

7. marketgarden_et

8. exodus_a4b

9. mlb_egypt

10. oasis

11. mml_church_et_v1

12. bergen

13. radar_summer_130

14. chartwell_140

15. 1944_nordwind

16. goldrush

17. caen_4

18. fueldump

19. parisbastille_b3

20. vesuvius_rev

21. wolken3_final

22. mml_helmsdeep_b4

23. tankbuster_200

24. mml_minastirith_fp3

25. mlb_beach

P.S Im using Win 7 64bit IE9 - Autoit Beta test in 32bit

Edited by Tardis
Link to comment
Share on other sites

  • 2 weeks later...

I can't have all of my users do this manually every time the browser window opens. This is a good suggestion, but it won't work for me. Thanks anyway!

I've solved this issue with a little function. See this sample:

#include <IE.au3>
$oIE = _IECreate()
_SetIE8($oIE)
MsgBox(0, '', "Now, check the browser setting by pressing F12 (after OK)")
Exit

Func _SetIE8($_oIE)
    If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned") Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned", "REG_DWORD", 0)
    $hwnd1 = _IEPropertyGet($_oIE, "hwnd")
    $titleOld = _IEPropertyGet($_oIE, "title")
    $titleNew = $titleOld & " " & Random(10000000, 99999999, 1)
    _IEPropertySet($_oIE, "title", $titleNew)
    ControlSend($hwnd1, "", "Internet Explorer_Server1", "{F12}")
    $titleF12 = $titleNew & " - F12"
    WinWait($titleF12, "", 5)
    WinSetState($titleF12, "", @SW_HIDE)
    $hwndF12 = WinGetHandle($titleF12)
    ControlSend($hwndF12, "", "ToolbarWindow321", "{alt}b8")
    WinClose($hwndF12)
    _IEPropertySet($_oIE, "title", $titleOld)
    WinActivate($hwnd1)
EndFunc   ;==>_SetIE8

Regards

Forumer100

Edit: modified function

Edited by forumer100

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

I have seen several reports now of both the click method and the form submit method not working in IE9 in standards mode (works in compatability mode). I do not have an explanation of this and searching for clues so far has come up dry, although I have not had a lot of time to research this.

The problem is not unique to AutoIt, but is a change in IE9 behaviour.

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 came across this issue in a hard to reproduce application (http://PeterZahlt.de)

You have to click on a image during a free phone call after about 10 minutes. If you don't click, the connection will be terminated after 30 seconds.

Not so easy for debugging. ;)

My helper script can click in IE8 mode but nope with IE9 mode. Therefore my _SetIE8 function as circumvention.

I would like to help debuging, but have no convienient reproducer.

Any simple reproducer out there ?

Regards Forumer100

Edit: Sorry, there is already a reproducer in this thread. See I should have scrolled backwards earlier. :)

Edited by forumer100

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Just found a DOCTYPE tag who is changing the behavior of the "click-problem":

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Perhaps it might be a hint in problem reseach. :)

Here my reproducer:

#include <ie.au3>
#include <file.au3>
Global $oIE, $filenameHTML, $html
OnAutoItExitRegister("_exit")
Func _exit()
    MsgBox(16 + 262144, "End of IE9 Test", @LF & "Bye, bye ..." & @LF, 0)
    _IEQuit($oIE)
    FileDelete($filenameHTML)
EndFunc   ;==>_exit
_IEErrorHandlerRegister()
_IEErrorNotify(1)
$tag = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
$answer = MsgBox(4 + 32 + 256 + 262144, "IE9 Test", $tag & @LF & @LF & "  Insert this 'DOCTYPE' tag as first line in HTML code ? " & @LF & @LF & "  If    YES   , the 'click-failure' will occour in IE9 mode." & @LF & @LF, 0)
If $answer = 6 Then $html &= $tag
$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(' & "'" & '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>'
;MsgBox(262144, "HTML Source",  $html , 0)

$filenameHTML = @ScriptFullPath & ".~temp~.HTML"
FileDelete($filenameHTML)
FileWrite($filenameHTML, $html)
ShellExecute($filenameHTML)
WinWait("IE9 Test", "", 2)
$oIE = _IEAttach("IE9 Test")
If $answer = 6 Then 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 = _IEGetObjByName($oIE, "Submit")
_IEAction($oSubmit, "click")
Exit

Btw: I made another reproducer totally without #include <IE.au3>

This proves that the malfunction is NOT related to the _IExx() UDF functions.

Regards Forumer100

Edit: Tested with Beta 3.3.7.12

Edited by forumer100

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

  • 2 weeks later...

#1975 - IE.au3 bug or something in COM we've broke?

I updated the BugTracker case with this fix info:

This is another issue introduced with the change to the ObjName function and the return value for different objects. The embedded object used to return "IWebBrowser2" and it now returns "WebBrowser". So, the fix is in IE.au3, function __IsObjType() change at line 3686:

from this

3685    Case "browser"
3686        If ($s_Name = "IWebBrowser2") Or ($s_Name = "IWebBrowser") Then $objectOK = True

to this

3685    Case "browser"
3686        If ($s_Name = "IWebBrowser2") Or ($s_Name = "IWebBrowser") Or ($s_Name = "WebBrowser") Then $objectOK = True

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

Dale you can even simplify that with a Reg Exp

If StringRegExp($s_Name, "^I?WebBrowser2?$") Then $objOK = True

That should catch any of the 3 and I assumed case sensitive (If not then add (?i) in front of the ^)

Explanation

^ = Start at the begining of the string

I? = "I" appears 0 or 1 time

"WebBrowser" must appear at either the first or second character position (depending on the "I")

2? = "2" appears 0 or 1 time

$ = Match at the end of the string

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Is there a need to catch all 3? As was mentioned before (by Jon I think), using the UDF library cross AutoIt versions is not supported so if the current AutoIt returns "WebBrowser" and nothing else then IE.au3 only needs to check for "WebBrowser".

Link to comment
Share on other sites

I just assumed that was for compatability between IE versions and not AutoIt versions.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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