Jump to content

[Solved] Problem with selecting radio buttons in webpage


Recommended Posts

I am trying to select the various radio buttons in this webpage which creates automated workouts to follow during the week.

I have already stumbled upon selecting things in a guy and even in a webpage, but this time I am not able to do it, don't know why...

Couald anyone help me to do a working selection code?

#include <ie.au3>
Global $oIe=_IECreate("C:/Agym.php.htm")
$oForm = _IEFormGetCollection ($oIE,1)
$Selection32=_IEFormElementGetCollection($oForm,0)
_IEFormElementRadioSelect($Selection32,'Running',"stat",1,"byValue")

This is what i tried but no luck :unsure:

I tried to mess up also with _IEFormGetObjByName and _IEFormElementGetValue but got nowhere near to it.

Thanks.

Agym.php.htm

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

When _IEFormElementCheckBoxSelect doesn't work, try _IEAction ! Posted Image

#include <Ie.au3>

$sURL = "file:///" & @DesktopDir & "\Agym.php.htm"
$oIE= _IECreate ( $sURL )
$oForms = _IEFormGetCollection ( $oIE )
For $oForm In $oForms
    ConsoleWrite ( "->--- Form name : " & $oForm.name & " Form method : " & $oForm.method & " Form action : " & $oForm.action & @CRLF )
    $index = 0
    $oFormElements = _IEFormElementGetCollection ( $oForm )
    For $oFormElement In $oFormElements
        ConsoleWrite ( "+>---             FormElement Index : " & $index & " FormElement Name : " & $oFormElement.name & " FormElement Type : " & $oFormElement.type & " FormElement Id : " & $oFormElement.Id & @CRLF )
        If $oFormElement.name = 'stat' And $index = 1 Then
            _IEAction ( $oFormElement, "Click" )
            ConsoleWrite ( '!->--             $oFormElement.name : ' & $oFormElement.name & @Crlf )
        EndIf
        $index += 1
    Next
Next

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Thanks, it will be very useful also for future uses. :unsure:

A clever way to use it, didn't knew it was possible to use _IeAction like this!

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

Thanks, it will be very useful also for future uses. :unsure:

A clever way to use it, didn't knew it was possible to use _IeAction like this!

When you manually select a checkbox, you need to click it,

so _IEAction can replace easily this action ! Posted Image

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

When you manually select a checkbox, you need to click it,

so _IEAction can replace easily this action ! Posted Image

Yes, i Just didn't know that exploring forms with GetCollection and similars was actually selecting the elements, and that you just needed to click it. I thought that GetCollection or similar just scan the document for forms.

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

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