Jump to content

[SOLVED] How do I use the IE UDF to click on a button on a webpage.


Recommended Posts

....Here are the results after changing _IEAttach to: 

$oIE = _IEAttach("A Window Title")

 

>Running:(3.3.14.5):ST_WO_BOT.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
@@ Debug(237) : $oIE = 0
>Error code: 7    Extended code: 0x00000001
--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEGetObjByName, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEAction(focus), $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
+>08:10:16 AutoIt3.exe ended.rc:0
+>08:10:16 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 64.41

 

Link to comment
Share on other sites

You need to reestablish a connection to the IE browser since it's getting lost in the initial _IELoadWait ( $_IESTATUS_ClientDisconnected ). Therefore, the logical way to handle this is to use _IEAttach to reconnect to IE.

As far as what value to use, it depends on the page being displayed. For the demo site you posted earlier, I would think either of the following would work --

$oIE = _IEAttach("Work Order Tracking")

$oIE = _IEAttach("maximo-demo75.mro.com", "url")

 

Link to comment
Share on other sites

Well, I am shocked... It actually works now. I did change some values but it connects and clicks where I wanted it to. Question solved. Thank you very much @Danp2. 

Here is the final working code:

$oIE = _IECreate("https://Proper_URL")

; Wait for a browser page load to complete
_IELoadWait($oIE)
Sleep(7000)

; Attach to a browser control embedded in another window
$oIE = _IEAttach("https://Proper_URL", "url")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & '    Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console

; Store the field names where the important data will be sent
Local $oSubmit = _IEGetObjById($oIE, "toolactions_INSERT-tbb_anchor")

Local $title = _IEPropertyGet($oIE, "title")
MsgBox($MB_SYSTEMMODAL, "", $title)

_IEAction($oSubmit, "focus")
_IEAction($oSubmit, "click")

Sleep(1000)

 

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

×
×
  • Create New...