By
Robdog1955
I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far.
#include <IE.au3>
Local $oIE = _IECreate("http://questchecker.com/")
Local $iQuestID = "123456"
Local $sCharacterName = "CharacterName"
Local $colForms = _IEFormGetCollection($oIE)
$iCount = 0
For $oForm In $colForms
$oFormElements = _IEFormElementGetCollection($oForm)
For $oFormElement In $oFormElements
$iCount = $iCount + 1
Local $sTagName = StringLower($oFormElement.tagName)
Local $sElementType = $oFormElement.type
Local $sElementName = $oFormElement.name
Switch $iCount
Case 6
_IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm
Case 7
_IEFormElementSetValue($oFormElement, $sCharacterName, 0)
Case 8
_IEFormElementSetValue($oFormElement, $iQuestID, 0)
EndSwitch
Next
Next
Local $oButtons = _IEGetObjByName($oIE, "questForm")
For $oButton In $oButtons
If _IEFormElementGetValue($oButton) = "US" Then
MsgBox(0, "", "Click Okay to set focus")
_IEAction($oButton, "focus")
MsgBox(0, "", "Click Okay to click button")
_IEAction($oButton, "click")
ExitLoop
EndIf
Next
MsgBox(0, "", "Click Okay to quit")
_IEQuit($oIE)
Exit