ThomasQ Posted September 14, 2011 Share Posted September 14, 2011 (edited) Hi All! I'm going a bit mental here.. If got this page I want to automate. The formelements, like buttons, textarea's and radio buttons are being called by Javascript.. Throug searching for Tags on the whole page, I found most elements I was looking for, a lot of wich I can manipulate with for example _IEFormElementGet & SetValue, or _IEAction. I came across these radio buttons I need to automate.. |<SPAN class="v-radiobutton v-select-option"><INPUT id=gwt-uid-1 tabIndex=0 CHECKED type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-1 __eventBits="4233">Customer Id</LABEL></SPAN>|<INPUT id=gwt-uid-1 tabIndex=0 CHECKED type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-1 __eventBits="4233">Customer Id</LABEL> <SPAN class="v-radiobutton v-select-option"><INPUT id=gwt-uid-2 tabIndex=0 type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-2 __eventBits="4233">E-mail</LABEL></SPAN>|<INPUT id=gwt-uid-2 tabIndex=0 type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-2 __eventBits="4233">E-mail</LABEL> |<SPAN class="v-radiobutton v-select-option"><INPUT id=gwt-uid-3 tabIndex=0 type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-3 __eventBits="4233">Naam</LABEL></SPAN>|<INPUT id=gwt-uid-3 tabIndex=0 type=radio name=PID10 __eventBits="4233"><LABEL for=gwt-uid-3 __eventBits="4233">Naam</LABEL> In the example for the function it suggest to use the function like so : IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue") or _IEFormElementRadioSelect ($oForm, 3, "radioExample", 1, "byIndex") One of the main things here is that I cannot find any Form on the page ( with _IEFormGetCollection), except an empty one : <form name="hrefFm" method="post" id="hrefFm" action=""></form> All other instances, I didn't need to specify the form itself, just references the the element, even though _IEFormElementGetValue for example seems to reference an element of a formll How do I check these radiobuttons?? If I Have to use _IEFormElementRadioSelect, how do I find the correct Form? All tags of the radiobuttons are found directly off the main page. There are two Iframes, but in there are other tags, no radioboxes. Anybody any idea on how to tackle this problem?? Many Thanks in advance, and guaranteed upvotes for the correct answer! -Thomas Edited September 14, 2011 by ThomasQ Link to comment Share on other sites More sharing options...
Juvigy Posted September 14, 2011 Share Posted September 14, 2011 Here is some oldschool IE script i wrote long time ago: $oIE = _IECreate("https://sofia.com/login.asp", 0, 1, 1, 1) $oDoc = _IEDocGetObj($oIE) $oArray = $oDoc.getElementsByTagName ("input") For $element In $oArray If $element.Name = "PID10" Then _IEFormElementSetValue($element, "your value") msgbox(0,"","Found it") Endif Next Link to comment Share on other sites More sharing options...
ThomasQ Posted September 14, 2011 Author Share Posted September 14, 2011 (edited) Thanks! Your script does return 4 instances of finding it! But when I Try to read the state like so: _IEFormElementRadioSelect($element, 1, "PID10", -1, "byIndex") I get --> IE.au3 V2.4-0 Error from function _IEFormElementRadioSelect, $_IEStatus_InvalidObjectType Anybody any idea what I'm doing wrong?? Thanks! Edited September 14, 2011 by ThomasQ Link to comment Share on other sites More sharing options...
ThomasQ Posted September 14, 2011 Author Share Posted September 14, 2011 (edited) Basicly, I need to finish this script, Without using _IEFormGetObjByName or _IEFormGetCollection, and with knowing only the Name of the radiobuttons. Can anybody help me out?? $oIE = _IE_Example ("form") $oDoc = _IEDocGetObj($oIE) $oArray = $oDoc.getElementsByTagName ("input") For $element In $oArray If $element.Name = "radioExample" Then _IEFormElementRadioSelect ($oDoc,2, "radioExample", 1, "byIndex") msgbox(0,"","Found it") Endif Next Edited September 14, 2011 by ThomasQ Link to comment Share on other sites More sharing options...
Juvigy Posted September 14, 2011 Share Posted September 14, 2011 You have th ID too - id=gwt-uid-1 try _IEFormElementRadioSelect ($element,1, "id=gwt-uid-1", 1, "byIndex") Link to comment Share on other sites More sharing options...
ThomasQ Posted September 14, 2011 Author Share Posted September 14, 2011 Thanks!, But nope, doesn't work mate. Isn't the ID used the same as the Name in the _IEFormElementRadioSelect function? I still can't select radiobuttons on the _IE_Example ("form") page with that last script I posted. Got any other suggestions? Link to comment Share on other sites More sharing options...
Juvigy Posted September 14, 2011 Share Posted September 14, 2011 Try this one: $oIE = _IECreate("https://sofia.com/login.asp", 0, 1, 1, 1) $oDoc = _IEDocGetObj($oIE) $oArray = $oDoc.getElementsByTagName ("input") For $element In $oArray If $element.id = "id=gwt-uid-1" Then $element.value =1 $element.selected = TRUE msgbox(0,"","Found it") Endif Next Do you use IE 9 ? If yes set it to compatibility mode Link to comment Share on other sites More sharing options...
ThomasQ Posted September 14, 2011 Author Share Posted September 14, 2011 Im using IE8, tried it with & without compatibility mode.. When using that one I keep getting this error: ==> The requested action with this object has failed.: $element.selected = TRUE $element.selected = TRUE^ ERROR Link to comment Share on other sites More sharing options...
Juvigy Posted September 14, 2011 Share Posted September 14, 2011 My bad - it is not selected but checked Change accordingly Link to comment Share on other sites More sharing options...
ThomasQ Posted September 14, 2011 Author Share Posted September 14, 2011 Thanks man! That works on the $oIE = _IE_Example ("form"). On the page I'm making the script for, it only works for a textarea beneath the radio buttons (it sets the $element.value =3 in the textarea). The text area shares the same name as the radio buttons. I'll do some digging later tonight Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now