sobert Posted October 6, 2014 Share Posted October 6, 2014 (edited) I am trying to create a script that can click a button in IE. The only issue is that I think this form is built in Java. When I use the AutoIT Info tool, nothing is displayed. Within IE, I click F12 to get the DOM Explorer and I've tried simulating the click using ControlSend and ControlClick with the id and class but I cannot get it to work. <A ondragstart="return false" onclick="return ImgBtnExecute(0)" tabIndex=100 onmouseover="return ImgBtnMouseOver(0);" onmouseout="window.status = window.defaultStatus;return true;" id=imgBtn0 class="button enabledattr buttonEnabled" href="#" name=imgBtn0><SPAN>Ed<U>i</U>t</SPAN></A> Thanks in advance. Edited October 6, 2014 by sobert Link to comment Share on other sites More sharing options...
Danp2 Posted October 6, 2014 Share Posted October 6, 2014 AutoIT Info Tool isn't designed to work on a web browser. Neither is ControlSend or ControlClick. You would need to use the _IE functions to interact with IE. Using the limited information that you've supplied, the following would retrieve the element by it's id: $oElement = _IEGetObjById ($oIE, "imgBtn0") This makes a bunch of assumptions ($oIE is a valid reference, no frames, etc). Once you have successfully retrieved the element, then you do something like this: _IEAction($oElement, "click") Give it a try and let us know how it goes. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Valuater Posted October 6, 2014 Share Posted October 6, 2014 (edited) This is ( or was) a great informational gathering tool for Internet Explorer... '?do=embed' frameborder='0' data-embedContent>> Good Luck!! 8) Edited October 6, 2014 by Valuater Link to comment Share on other sites More sharing options...
sobert Posted October 6, 2014 Author Share Posted October 6, 2014 (edited) AutoIT Info Tool isn't designed to work on a web browser. Neither is ControlSend or ControlClick. You would need to use the _IE functions to interact with IE. Using the limited information that you've supplied, the following would retrieve the element by it's id: $oElement = _IEGetObjById ($oIE, "imgBtn0") This makes a bunch of assumptions ($oIE is a valid reference, no frames, etc). Once you have successfully retrieved the element, then you do something like this: _IEAction($oElement, "click") Give it a try and let us know how it goes. I tried adding the two lines but nothing happens. It jumps right to the tab. WinWaitActive ("CA Service Desk Manager - ", "") local $oElement = _IEGetObjById ($oIE, "imgBtn0") _IEAction($oElement, "click") opt("SendKeyDelay",75) Send("{TAB 24}{Enter}") Sleep (4000) Edited October 6, 2014 by sobert Link to comment Share on other sites More sharing options...
JohnOne Posted October 6, 2014 Share Posted October 6, 2014 How are you getting reference to IE object ($oIE)? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Danp2 Posted October 7, 2014 Share Posted October 7, 2014 Yeah... show us your full script or at least a working example. If you haven't already done so, you can get a reference to the IE tab using something like this: $oIE = _IEAttach("CA Service Desk Manager") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sobert Posted October 7, 2014 Author Share Posted October 7, 2014 Sorry, I do not know how to format the code nicely like you guys. Below is my code. The links wont work because this is our company ticketing system. http://servicedesk/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+SKIPLIST=1+QBE.EQ.id=626430 is the link that takes you to the ticket. Once the page loads, the URL changes to http://servicedesk/CAisd/pdmweb.exe. The Title bar is CA Service Desk Manager - ###### Request Detail. main () func main() _IECreate("http://servicedesk/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+SKIPLIST=1+QBE.EQ.id=626430") Local $oIE = _IEAttach ("CA Service Desk", "http://servicedesk/CAisd/pdmweb.exe") local $oElement Sleep (9000) $oElement = _IEGetObjById ($oIE, "imgBtn0") _IEAction($oElement, "click") EndFunc Link to comment Share on other sites More sharing options...
Danp2 Posted October 7, 2014 Share Posted October 7, 2014 Sorry, I do not know how to format the code nicely like you guys. Use the icon with the blue A in the toolbar. You shouldn't need to use both _IECreate and _IEAttach. Try the following: #include <IE.au3> Local $oIE = _IECreate("http://servicedesk/CAisd/pdmweb.exe?OP=SEARCH+FACTORY=cr+SKIPLIST=1+QBE.EQ.id=626430") Local $oElement = _IEGetObjById ($oIE, "imgBtn0") _IEAction($oElement, "click") Run this code in Scite and post the output window results. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sobert Posted October 7, 2014 Author Share Posted October 7, 2014 >"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:UsersrsoDesktopTest.au3" --> IE.au3 T3.0-1 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.) --> IE.au3 T3.0-1 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-1 Error from function _IEAction(click), $_IESTATUS_InvalidDataType>Exit code: 0 Time: 10.22 Link to comment Share on other sites More sharing options...
Danp2 Posted October 7, 2014 Share Posted October 7, 2014 Probably same issue as described >here. Probably the simplest solution is go revert back to the _IECreate / _IEAttach combo. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now