Jump to content

checking checkbox on website


phew
 Share

Recommended Posts

heeloowww,

i'm trying to check the AGB checkbox on http://www.meta-sms.de/

honestly i didnt get this _IE...Obj.. functions really..

here is my code:

#include <IE.au3>

$url = "http://www.meta-sms.de/"
$oIE = _IECreate ($url, 1)

$checkbox = _IEFormGetObjByName ($oIE, "ID_CheckAGB")
$check = _IEFormElementCheckBoxSelect($checkbox, "ID_CheckAGB", "", 1, "byIndex", 0)
MsgBox(0, "", $check)

it always returns @error = 3 (($_IEStatus_InvalidDataType) = Invalid Data Type)

what am i doing wrong? someone can please give me a working example?

Link to comment
Share on other sites

heeloowww,

i'm trying to check the AGB checkbox on http://www.meta-sms.de/

honestly i didnt get this _IE...Obj.. functions really..

here is my code:

#include <IE.au3>

$url = "http://www.meta-sms.de/"
$oIE = _IECreate ($url, 1)

$checkbox = _IEFormGetObjByName ($oIE, "ID_CheckAGB")
$check = _IEFormElementCheckBoxSelect($checkbox, "ID_CheckAGB", "", 1, "byIndex", 0)
MsgBox(0, "", $check)

it always returns @error = 3 (($_IEStatus_InvalidDataType) = Invalid Data Type)

what am i doing wrong? someone can please give me a working example?

_IEFormElementCheckBoxSelect needs you to pass a Form element to it - $checkbox is an <INPUT> form element.

#include <IE.au3>

$url = "http://www.meta-sms.de/"
$oIE = _IECreate ($url, 1)

$oForm = _IEFormGetCollection($oIE, 0)
$check = _IEFormElementCheckBoxSelect($oForm, 0, "ID_CheckAGB", 1, "byIndex", 0)
MsgBox(0, "", $check)

Also, when using byIndex, the second parameter is the checkbox index (0 in this case)

Dale

p.s. @eviltoaster's method works for this specific case, but you need to make changes if there is more than one checkbox and if you are not certain if it is check already there is additional code needed to see or you will uncheck it with that code...

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

it's still not working for me, msgbox shows up with "0" what means @error

SCITE Reply:
--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch
--> IE.au3 Warning from function _IEFormElementCheckboxSelect, $_IEStatus_NoMatch

but thx for your reply

Link to comment
Share on other sites

Are you certain? The code I posted work fine for me over and over again.

Dale

p.s. the _IEAttach NoMatch is expected unless you already have the site up

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

bah, i exactly use

#include <IE.au3>

$url = "http://www.meta-sms.de/"
$oIE = _IECreate ($url, 1)

$oForm = _IEFormGetCollection($oIE, 0)
$check = _IEFormElementCheckBoxSelect($oForm, 0, "ID_CheckAGB", 1, "byIndex", 0)
MsgBox(0, "", $check)

and my msgbox shows "0" <_<

Link to comment
Share on other sites

haha that is so strange, now after pc reboot it works, also when i didn't change anything to the code o_O

thanks for your help guys

EDIT:

wtf, slowly i'm going crazy. now it worked for a few times and the msgbox showed me "1" and the box was checked, and without changing anything to the code it stopped working again - msgbox shows a 0. someone knows what i'm doing wrong?

Edited by phew
Link to comment
Share on other sites

Suggest you remove the try_attach from the _IECreate ( the 1 parameter). It is possible that after interacting with the page, the URL stays the same, but the elements on the page are changed with dynamic HTML that would cause trouble with the assumptions in the script. E.g. since the form has no name attribute you are grabbing it based on being the first form on the page, index 0 -- if a new form dynamically gets inserted at the top of the page, the form you want is no longer form 0.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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