Sign in to follow this  
Followers 0
icu

[Solved] Forcing IE9 into IE8 Browser Mode?

9 posts in this topic

#1 ·  Posted (edited)

Right so IE9 breaks AutoIt scripts... and the Devs are working on it and the Beta may fix things.

Mean time the best 'work around' solution offered from my research of the forum is to set IE9 into an older and compatible mode for AutoIt (F12 and then select the option). Problem is I can't seem to find a UDF for setting the Browser Mode to 'IE8' and while I can set the Document Mode to IE8 (via sending Alt+8) this doesn't fix the problem of running AutoIt IE scripts. I've tried the UDF code offered at this posting however both sets of code offered does not seem to work. After spending an afternoon searching Google for solutions (and not finding anything), then experimenting with Exit's and supersonic's code, and my own stuff from scratch I've come back with nothing so this is a general shout out for help.

Does anyone have a UDF that specifically forces IE9 into IE8 Browser Mode?

Please share if you've got one that is working with IE 9.0.10 running on Win7 64bit.

I don't want to have to learn Scrapy or buy Screen Scraper Studio or use Sikuli if I already know AutoIt :-(

Edited by icu

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You're being specific with Win7 x64 IE 9.0.10 .

IMO, I don't think IE.au3 should be used outside a "controlled" environment.

So... Why no just run a virtual machine with with XP or something that runs IE6/7 that you know works, instead of spending days ( = $ ) trying to figure out a total re-write of the IE.au3 library is needed?

Unless you're "FLUENT" in Javascript/Ajax/JQuery, no sense in beating the bush ( trust me! ).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Good suggestion.

Also you could use an embedded IE perhaps, which I do not think would be IE9 either.

It follows default if you're referring to Shell.Explorer.2

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Thank you both for your replies,

@SmOke_N: Yeah a VM running legacy software is another work around idea and is a solution I found when doing my Google research. As for being specific I thought it would be best to actually state what windows and IE version AutoIt is breaking on. Of course a VM will work but I wanted a 'portable' code solution across all my PCs (WinXP, Vista and Win7)--that is, a single compiled AutoIt script that would not be Windows or IE dependent.

However since posting I may have found a solution but it needs more time and energy to test. Basically it would involve creating an account with spoon.net since they have a browser sandbox and then using AutoIt to use the command prompt to execute spoon.net and launch IE8. Once IE is launched, get AutoIt to attach to IE8 and do its thing. I don't have time now to start scripting for this but I thought I would quickly put a post up in case others are also looking for a solution right now.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Embedded IE will fix your problem because it will be IE7 rendered (max IE8).

If you dont want embedded, here is a way to force all IE instances to render as <9

$64Bit = ""
If @ProcessorArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" & $64Bit & "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later


$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

I picked it up somewhere on the forum and edited a bit.

Credits to the unknown user.

TESTED: WIN XP, WIN7, WIN8

BTW. Your avatar??

Edited by milos83

Share this post


Link to post
Share on other sites

@milos83 THANK YOU SO MUCH!

However your code needs updating to change @ProcessorArch to @OSArch as per this The modified code is below if any others stumble upon this post.

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" & $64Bit & "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

Again I can't express my gratitude for your post! Just out of interest what code modifications would need to be made to force IE from version 7 to 8 or back to 9? The code above currently sets IE to version 7 and writing to registry is beyond my knowledge of Windows. Also, what was the original forum post that you took this code from?

Lastly, my avatar pic has multilayered meanings to me. PM me if you are curious.

Kind regards,

icu

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@milos83 THANK YOU SO MUCH!

However your code needs updating to change @ProcessorArch to @OSArch as per this The modified code is below if any others stumble upon this post.

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" &amp; $64Bit &amp; "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' &amp; $struser &amp; '",Domain="' &amp; @ComputerName &amp; '"')
RegWrite("HKU" &amp; $64Bit &amp; "" &amp; $objAccount.SID &amp; "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" &amp; $objAccount.SID &amp; "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

Again I can't express my gratitude for your post! Just out of interest what code modifications would need to be made to force IE from version 7 to 8 or back to 9? The code above currently sets IE to version 7 and writing to registry is beyond my knowledge of Windows. Also, what was the original forum post that you took this code from?

Lastly, my avatar pic has multilayered meanings to me. PM me if you are curious.

Kind regards,

icu

I use @ProcessorArch because my Autoit version is old.

For reverting rendering

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf

$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 0)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 0)

Also, what was the original forum post that you took this code from?

Idk,Use search to find that post

Edited by milos83

Share this post


Link to post
Share on other sites

I hope this bumps this post back to the top to get respondents but I need to revive this post. Will this still work today? Does this permanently switches the browser mode to below IE9 or does it do it permanently? I need to find a way to just temporary use IE8 during the execution of Autoit Script but retain the IE9 since I have sites that requires higher than IE8.

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

  • Similar Content

    • nassausky
      By nassausky
      Hi all,
       
      Anyone have any idea how to close all open tabs except a specific one I manually open.  Assuming I don't know what is open in all the tabs except just the one I want to keep open.
       
      I didn't want to use sendkeys and I was trying to use the following code to list the title (or url) of the 3 open tabs and  after I got that part working I would just close the other 2. This sample only displays the title of the first open tab
      #include <IE.au3> Const $ie_new_in_tab = 0x0800 $oIE = _IECreate("https://www.autoitscript.com") __IENavigate($oIE, "https://www.autoitscript.com/forum/", 1, $ie_new_in_tab) ;(obj,url,wait,param) __IENavigate($oIE, "https://www.google.com/", 1, $ie_new_in_tab) ;(obj,url,wait,param) Local $aIE[1] $aIE[0] = 0 Local $i = 1, $oIE While 1     $oIE = _IEAttach("", "instance", $i)     If @error = $_IEStatus_NoMatch Then ExitLoop     ConsoleWrite(_IEPropertyGet($oIE, "title") & @CRLF)     ReDim $aIE[$i + 1]     $aIE[$i] = $oIE ;each item holds object     $aIE[0] = $i ;first item holds count     $i += 1 WEnd MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0]) ; This doesn't return the list of tabs in the console just the first tab  
      Thanks for any and all help
    • toto22
      By toto22
      I'm trying to click on Java Dropbox using IE. However, I'm running into problems. There is a Dropbox "Please Select" with two options "Buy" and "Sell".
      I'm able to click on a drop box (please see code below) but i'm unable to select "Buy" or "Sell"".
      Local $sMyString = "Please Select" ;############ ENTER ############# Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next  
      Please help
       
         
    • Gowrisankar
      By Gowrisankar
      Hello everyone,
      I'm working on a task where, a PDF file is opened (in IE browser) when I click a link in a website.
      I have to read the first page of the PDF to find particular strings. Can you please share some ideas?
    • Seminko
      By Seminko
      Hey,
      i would like to set a value into an INPUT field.
      Checked the _IEFormElementSetValue function but that does require _IEFormGetObjByName and this is where the problem comes in. The input field I want to write to is not a part of a form tag. It is part of a table.
      <input type="text" class="w2" id="nabidka_vozidel_formular_tach_od" name="nabidka_vozidel_formular_tach_od" onchange="GLOBAL.pocetInzerceNZ(&quot;nabidka_vozidel_formular&quot;,&quot;tach_od&quot;,&quot;&quot;);" autocomplete="off"> I tried this but that didn't work:
      $oDownloadSamples = _IEGetObjById($oIE, "nabidka_vozidel_formular_tach_od") _IEFormElementSetValue($oDownloadSamples, "123") If you want to try the site I'm working with is https://www.tipcars.cz/. There is a menu on the top left hand side and if you click the "vyhledat" button the input fields will show up.
      Thanks
    • Seminko
      By Seminko
      I am now able to populate the dropdown menus at https://www.tipcars.com/.
      The dropdowns are dynamic and do not have a Text value, only ids.
      Is there a way to get all the available options from a dropdown?
      $url = "https://www.tipcars.com/" $oIE = _IECreate($url) _IELoadWait($oIE) $oDownloadSamples = _IEGetObjById($oIE, "homepage_vyhl_frm_vozidlo") _IEFormElementOptionSelect($oDownloadSamples, "C") Above code, populates ID 'C' into the 'druh' dropdown, which results in selecting 'užitkové'. 
      Is there a way so I can grab all of the options from the dropdown menu? I could easily grab all the IDs but I am afraid they will change in the future so I would much rather match the text titles and assign the option IDs grabbed from site.
      This is what the options are according to Chrome:
      <select class="w1"id="homepage_vyhl_frm_vozidlo"name="homepage_vyhl_frm_vozidlo"onchange="try{NABIDKA_VOZIDEL_FORMULAR.naplnSelectZnacka('homepage_vyhl_frm');GLOBAL.pocetInzerceHZ('homepage_vyhl_frm','vozidlo');}catch(ex){odeslatJsChybu('formHOMEPAGE onChange 1: ' + ex.message, 'formHomePage onChange 1', -1);}"> <option value="A" style="color: black;">osobní a terénní (56 334)</option> <option value="C" style="color: black;">užitkové (4 333)</option> <option value="D" style="color: black;">nákladní (3 742)</option> <option value="E" style="color: black;">autobusy (56)</option> <option value="F" style="color: black;">obytné (373)</option> <option value="G" style="color: black;">přívěsy (1 179)</option> <option value="J" style="color: black;">motorky (780)</option> <option value="S" style="color: black;">pracovní stroje (605)</option> <option value="L" style="color: black;">ostatní (235)</option></select> Also, this cannot be grabbed by _INetGetSource.
      Thanks