Sign in to follow this  
Followers 0
SoftwareJock

Script Worked Under Internet Explorer 8, Fails Under Internet Explorer 9

5 posts in this topic

After upgrading from Internet Explorer 8 to Internet Explorer 9, my AutoIt script fails on an http (not https) web page in selecting an element from a list & submitting a form.

The web page code for the list is:

<td width="50%"><b>Source:</b>

</td>

<td width="50%"><select size="1" name="SourceBox" onchange="javascript:setTimeout('__doPostBack(\'SourceBox\',\'\')', 0)" id="SourceBox">

<option selected="selected" value="">Any Enabled</option>

<option value="83bb989f-a591-4d5b-92f9-106320695cb3">S-Video</option>

</select></td>

The web page code for the submit is:

<p align="center"><input type="submit" name="Submit" value="Submit" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Submit&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="Submit" />

</p>

The related code in my script, which worked under IE 8, is:

$oReturn = _IEFormElementSetValue ($oSourceBox, "S-Video")

if $oReturn = 0 Then

MsgBox(16, "Error", "_IEFormElementOptionselect on $oSourceBox failed")

Exit

EndIf

; Click Submit button.

$oSubmitButton = _IEGetObjByName ($oIE, "Submit")

if $oSubmitButton = 0 Then

MsgBox(16, "Error", "_IEGetObjByName on Submit failed")

Exit

EndIf

$oReturn = _IEAction ($oSubmitButton, "click")

if $oReturn = 0 Then

MsgBox(16, "Error", "_IEAction on Submit failed")

Exit

EndIf

I modified the code as follows but this code also failed to submit the web page.

$oForm = _IEFormGetObjByName($oIE, "Form1")

if $oForm = 0 Then

MsgBox(16, "Error", "_IEFormGetObjByName on Form1 failed")

Exit

EndIf

$oReturn = _IEFormSubmit($oForm)

if $oReturn = 0 Then

MsgBox(16, "Error", "_IEFormSubmit on $oForm failed")

Exit

EndIf

The failure symptoms are that both the element selection action & submit action have no effect; they are essentially ignored. (None of the MsgBox/Exit checks are executing so the _IE functions are returning successful return codes.)

I first tried the release version of AutoIt, 3.3.6.1, without success. Now I am using the beta version, 3.3.7.10, & it fails, too.

Does anyone have a solution or workaround for this problem? I would be eternally grateful.

Thanks.

Share this post


Link to post
Share on other sites



Try the IE9 compatibility mode. Also lower the security settings.

Share this post


Link to post
Share on other sites

Have you tried the _IE error handler already?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I had the same problem with submitting a form in IE9. It worked great in IE8 but for some reason the _IEFormSubmit function didn't do anything.

What I did was turn on the compatibility mode in the registry.

If StringLeft(RegRead("HKLM\SOFTWARE\Microsoft\Internet Explorer\Version Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
  $wshNetwork = ObjCreate("WScript.Network")
  $struser = $wshNetwork.Username
  $objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
  $objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
  RegWrite("HKU\" & $objAccount.SID & "\Software\Microsoft\Internet Explorer\BrowserEmulation\", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

After I did this the _IEFormSubmit worked. Hope this helps.

Edited by Zuldan23

Share this post


Link to post
Share on other sites

The was a known issue with ObjName() that caused some IE9 objects to be missed by the IE.au3 UDF functions. An ObjName() change and some tweaks to IE.au3 by DaleHohm are coming. Make sure you've tried it with the latest Beta.

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0