Sign in to follow this  
Followers 0
sobert

Clicking Button in IE not Detected by AutoIT Window Info

10 posts in this topic

#1 ·  Posted (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 by sobert

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by sobert

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

>"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

Share this post


Link to post
Share on other sites

Probably same issue as described >here. Probably the simplest solution is go revert back to the _IECreate / _IEAttach combo.

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