Forum Discussion
googleid_102416
12 years agoContributor
Can somebody please test this function on different systems and report back if it's working? I guess Window("ToolbarWindow32") will fail on x64 systems.
function switchIEBrowserMode(browser_mode_id) {
var menu_items = {
"ie7": "Internet Explorer 7",
"ie8": "Internet Explorer 8",
"ie9": "Internet Explorer 9"
};
if(!browser_mode_id in menu_items)
return -1;
var browser = Sys.Browser("iexplore");
var browser_window = browser.BrowserWindow(0);
var toolbar = findIEDevToolsMenu(browser_window);
if(!toolbar || !toolbar.Visible) {
browser_window.Keys("[F12]");
toolbar = findIEDevToolsMenu(browser_window);
}
toolbar.ClickItem(9); // click on "&Browser Mode:*" menu item
toolbar.PopupMenu.Click(menu_items[browser_mode_id]);
browser_window.Keys("[F12]");
function findIEDevToolsMenu(ieWindow) {
var devToolsMenu = ieWindow.Find("WndClass", "IEDEVTOOLSMENU", 1000);
if(!devToolsMenu || !devToolsMenu.Exists)
return false;
return devToolsMenu.Window("ToolbarWindow32");
}
}
function switchIEBrowserMode_UnitTest(){
switchIEBrowserMode("ie8");
}
Related Content
- 12 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago