DCAlliances Posted July 6, 2010 Posted July 6, 2010 (edited) I have the following code in HTML and as you can see there is fired on changes and I couldn't make it to select the third option: <select name="ctl00$ContentPlaceHolder1$ddlReportType" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$ddlReportType\',\'\')', 0)" id="ctl00_ContentPlaceHolder1_ddlReportType"> <option selected="selected" value="KeyUserSummary">Key User Summary</option> <option value="SummaryResultAnswer">Summary Result With Answers</option> <option value="SummaryResultNoAnswer">Summary Result Without Answers</option> </select> and this is the autoit script: expandcollapse popup$oIE = _IECreate ("http://localhost/tvi/") ; get pointers to the login form and username, password and signin fields $o_form = _IEFormGetObjByName ($oIE, "form1") ;The form id changed $o_login = _IEFormElementGetObjByName ($o_form, "tbUsername") $o_password = _IEFormElementGetObjByName ($o_form, "tbPassword") $o_signin = _IEFormElementGetObjByName ($o_form, "btnLogin") ;the button name changed $username = "***" $password = "XXXX" ; Set field values and submit the form _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) _IEAction ($o_signin, "click") _IENavigate ($oIE, "http://localhost/tvi/Admin/SurveyReportByIndividual.aspx") $oForm = _IEFormGetCollection($oIE, 0) $colElem = _IEFormElementGetCollection($oForm) ;$iElemCnt = @extended ;$sMsg = "Element values:" & @CRLF ;$i = 0 ;For $oElem In $colElem ; $sMsg &= $i & ": " & _IEFormElementGetValue($oElem) & @CRLF ; $i += 1 ;Next ;MsgBox(64, $iElemCnt & " Results", $sMsg) $oIE = _IE_Example ("http://localhost/tvi/Admin/SurveyReportByIndividual.aspx") $oForm = _IEFormGetCollection($oIE, 0) $o_ReportType = _IEFormGetObjByName ($oForm, "ctl00$ContentPlaceHolder1$ddlReportType") ;The form id changed $test = _IEFormElementOptionselect($o_ReportType, "Summary Result Without Answer", 1, "byText"); Edited July 6, 2010 by DCAlliances
jfcby Posted July 6, 2010 Posted July 6, 2010 DCAlliances, At this line of your code: $o_ReportType = _IEFormGetObjByName ($oForm, "ctl00$ContentPlaceHolder1$ddlReportType") ;The form id changed I see there are dollar signs. Are they suppose to be variables? If so then it should be like this: $o_ReportType = _IEFormGetObjByName ($oForm, "ctl00" & $ContentPlaceHolder1 & $ddlReportType) ;The form id changed jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****
DCAlliances Posted July 6, 2010 Author Posted July 6, 2010 Hi jfcby Actually I've managed to make it works. That control name is name of the dropdownlist which I suppose to use the ID instead. I just found that I can use the SciTe tools so I can sort of debugging which is cool! Thanks
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