Micro Focus QTP (UFT) Forums
Click on IE10 tools --> f12 --> Comaptaibilty view to IE8 - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Click on IE10 tools --> f12 --> Comaptaibilty view to IE8 (/Thread-Click-on-IE10-tools-f12-Comaptaibilty-view-to-IE8)



Click on IE10 tools --> f12 --> Comaptaibilty view to IE8 - theology - 12-18-2014

Hi,
I have to open a IE session thne click on tools --> F12 and then change the setting to Comaptability mode ie 8.

Recorder below code but its not working.

Can you please help with DP.

Code:
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","%HOMEDRIVE%%HOMEPATH%",""
Browser("Internet Explorer Enhanced").WinToolbar("ToolbarWindow32").Press "&Tools"
Browser("Internet Explorer Enhanced").WinMenu("ContextMenu").Select "F12 developer tools"
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","%HOMEDRIVE%%HOMEPATH%",""
Browser("Internet Explorer Enhanced").Page("Internet Explorer Enhanced").Sync



RE: Click on IE10 tools --> f12 --> Comaptaibilty view to IE8 - kamalteja - 12-20-2014

You got to use Shell Scripting as part of your VB Script and below is the code

In the below code for the following line 1 is to Enable and 0 is to Disable "oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,1"

Code:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation"
strValueName = "MSCompatibilityMode"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,1
If Err = 0 Then
   oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
   WScript.Echo "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation\MSCompatibilityMode"& "contains " & dwValue
Else
   WScript.Echo "Error in creating key" & " and DWORD value = " & Err.Number
End If



RE: Click on IE10 tools --> f12 --> Comaptaibilty view to IE8 - theology - 12-20-2014

Thanks Kamal:

I tried executing this on my box but still it showing view as IE10 , not changed to IE8.

Executed as test.vbs and test.bat file.

Apart from This I tried code like below , it press f12 but I donbt know how to click compatible view and select IE8.

Code:
Set WshShell = CreateObject("WScript.Shell")
        While Window("Developer Tools").Exist(2) = False
            Browser("micclass:=Browser").Page("micclass:=Page").SetTOProperty "focus", True
            WshShell.AppActivate "Internet Explorer"
            WshShell.SendKeys("{F12}")
            Wait(2)    
        Wend

        WshShell.AppActivate "Developer Tools"
        WshShell.SendKeys("%c")
        Wait(2)