Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: IE MSIE Internet Explorer InternetExplorer.Application IE 7 8 9 Click Focus Method Fail Button Compatibility View Web Page HTM HTML CreateEvent InitEvent Dispatch Event HTMLEvents Issue Problem Ignored Enable Protected Mode
I see you are trying to click on an a href link. One workaround is to get the href value of the link and use the navigate method to navigate to that page.
I see when I load the webpage that the Compatibility icon gets displayed. This indicates compatibility issue with this webpage on IE9. Try adding the webbage to compatibility view. http://blogs.msdn.com/b/ie/archive/2009/06/17/compatibility-view-and-smart-defaults.aspx
;IE9 Click Fix #DefineFunction WaitForBrowser(Browser) While Browser.Busy || Browser.ReadyState <> 4 TimeDelay(0.5) EndWhile Return #EndFunction url = "http://sirsi.emu.edu/uhtbin/webcat" objBrowser = ObjectOpen("InternetExplorer.Application") objBrowser.Visible = @TRUE objBrowser.Navigate(url,0,'','','') WaitForBrowser(objBrowser) objAnchorElements = objBrowser.document.GetElementsByTagName("a") ForEach objElement In objAnchorElements If objElement.innerText == "Power Search" || objElement.innerText == "Advanced Search" Then ; CLICK FAILS unless page is set to view in Compatibility View. ; objElement.Click ; WORKAROUND 1 ; Get href then navigate ;objBrowser.Navigate(objElement.href) ; WORKAROUND 2 ; createEvent initEvent DispatchEvent objEvent = objBrowser.document.createEvent("HTMLEvents") objEvent.initEvent("click", @TRUE, @TRUE) objElement.dispatchEvent(objEvent) Break EndIf Next WaitForBrowser(objBrowser) Message('','Advanced Search page should now be visible') objBrowser.quit objBrowser = 0
Article ID: W18130
Filename: IE9 Click or Focus Methods Fail.txt
File Created: 2013:02:21:08:51:18
Last Updated: 2013:02:21:08:51:18