Sign in to follow this  
Followers 0
jefhal

Can't click on webpage buttons and radio buttons

3 posts in this topic

#1 ·  Posted (edited)

I'm trying to automate clicking on this webpage:

http://www.wmur.com/fridaynightfootball/14...75/detail.html#

The script I am using now is the brute force method to click on the "Vote" button. However, when I try to use ie.au3 library, I cannot click on the radio buttons or the Vote button.

Here is my code using the manual method:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=c:\program files\autoit3\examples\votenow2.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;vote now
HotKeySet("{ESC}","_Terminate")
Opt("TrayIconDebug",1)
;Run('"C:\Program Files\Internet\SlimBrowser\sbrowser.exe" http://www.wmur.com/fridaynightfootball/14303175/detail.html#',@TempDir)
Run("C:\Program Files\AutoIt3\Au3Info.exe",@TempDir)
$x = InputBox("X","What is x?")
$y = InputBox("Y","What is y?")
;WinActivate("Slimbrowser","")
While 1
    WinActivate("Vote Now For The","")
    MouseClick("LEFT",$x,$y)
    Sleep(100)
    ;Send("!fu")
    Sleep(100)
    ProgressOn("Progress Meter", "Increments every second", "0 percent",1000,800)
    For $i = 10 to 100 step 25
        sleep(10000)
        ProgressSet( $i, $i & " percent")
    Next
    ProgressSet(100 , "Done", "Complete")
    sleep(500)
    ProgressOff()

WEnd
Func _Terminate()
    Exit 0
EndFunc

The radio button I want to click is the middle one.

Thanks!

Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

This is close, but it kicks the pop-up blocker, so I don't know if it works all the way through (and I have no intention of turning off my pop-up blocker):

#include <IE.au3>

$sURL = "http://www.wmur.com/fridaynightfootball/14303175/detail.html#" 
$oIE = _IECreate($sURL)
$colInputs = _IETagNameGetCollection($oIE, "INPUT")
$iInputCnt = @extended
ConsoleWrite("Debug: Found " & $iInputCnt & " input tags" & @LF)
If $iInputCnt Then
    For $oInput In $colInputs
        If $oInput.id = "q1ans2"  Then
            ConsoleWrite("Debug: Found q1ans1 radio input" & @LF)
            _IEAction($oInput, "click")
            ExitLoop
        EndIf
    Next
    
    For $oInput In $colInputs
        If $oInput.type = "button"  And $oInput.value = "Vote"  Then
            ConsoleWrite("Debug: Found Vote button input" & @LF)
            _IEAction($oInput, "click")
            ExitLoop
        EndIf
    Next
EndIf

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Thank you PsaltyDS, I will try this this afternoon. My code using ie.au3 did not work, but I think it's because I'm using an older version:

#include <IE_T2.0_2.au3>
#include <array.au3>
;_IEErrorHandlerRegister()
MsgBox(1,"msg","got to 1")
$oIE = _IECreate ()
MsgBox(1,"msg","got to 2")
_IENavigate ($oIE, "http://www.wmur.com/fridaynightfootball/14230008/detail.html")
;_IEFormElementRadioSelect("answer1","","q1ans2")
WinWait("WMUR.com - Friday Night Football - Windows Internet Explorer")
;sleep(10000)
MsgBox(1,"msg","got to 3")
;WinActivate("New Hampshire News, Manchester News, Weather & Sports, Channel 9 TV - WMUR","")
;~ $oForms = _IEFormGetCollection($oIE) 
;~ $iCount = @EXTENDED
;~ MsgBox(1,"$iCount",$iCount)
;~ $oForm = _IEFormGetCollection($oIE, 2)
;~ MsgBox(1,"$oForm",$oForm)
;~ ;_ArrayDisplay($oForm,"$oForm")
;~ _IEFormElementCheckBoxSelect($oForm, "true", "agree") ; Green
$oIE = _IEAttach("Looking for restaurants")
$oBox = _IEGetObjById($oIE, "all")
_IEAction($oBox, "click")oÝ÷ Ú«¨µéÚ

:)


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

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