Jump to content

Clicking Button in IE not Detected by AutoIT Window Info


 Share

Recommended Posts

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
Link to comment
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.

Link to comment
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.

 

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
Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...