kelso Posted June 25, 2016 Share Posted June 25, 2016 Hello Guys, I am trying to create an AutoIt script to choose specific value (300) from an HTML drop-down list - example below: <select name="myDropDownList" tabindex="2"> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> <option value="500">500</option> </select> I tried multiple functions, but none of them seem to do what I am trying to achieve. Any help is appreciated, thanks. Link to comment Share on other sites More sharing options...
AutoBert Posted June 25, 2016 Share Posted June 25, 2016 Have you tried _IEFormElementOptionSelect? Link to comment Share on other sites More sharing options...
kelso Posted June 25, 2016 Author Share Posted June 25, 2016 18 minutes ago, AutoBert said: Have you tried _IEFormElementOptionSelect? Yes, see below- Local $oIE = "http://localhost/index.asp" Local $oForm = _IEFormGetObjByName($oIE, "webForm") Local $oSelect = _IEFormElementGetObjByName($oForm, "myDropDownList") _IECreate("http://localhost/index.asp") _IEAction($oSelect, "focus") For $i = 1 To 10 _IEFormElementOptionSelect($oSelect, "200", 1, "byText") Sleep(1000) _IEFormElementOptionSelect($oSelect, "300", 1, "byValue") Sleep(1000) _IEFormElementOptionSelect($oSelect, 0, 1, "byIndex") Sleep(1000) Next Link to comment Share on other sites More sharing options...
AutoBert Posted June 25, 2016 Share Posted June 25, 2016 Test this script: Local $oIE = _IECreate("http://localhost/index.asp") ConsoleWrite("_IECreate " & @error & @TAB & @extended & @CRLF) Local $oForm = _IEFormGetObjByName($oIE, "webForm") ConsoleWrite("_IEFormGetObjByName " & @error & @TAB & @extended & @CRLF) Local $oSelect = _IEFormElementGetObjByName($oForm, "myDropDownList") ConsoleWrite("_IEFormElementGetObjByName " & @error & @TAB & @extended & @CRLF) _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, "200", 1, "byText") ConsoleWrite("byText " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEFormElementOptionSelect($oSelect, "300", 1, "byValue") ConsoleWrite("byValue " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEFormElementOptionSelect($oSelect, 0, 1, "byIndex") ConsoleWrite("byIndex " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEQuit($oIE) and post the output from Sciteconsole. Link to comment Share on other sites More sharing options...
kelso Posted June 27, 2016 Author Share Posted June 27, 2016 On 6/25/2016 at 1:31 AM, AutoBert said: Test this script: Local $oIE = _IECreate("http://localhost/index.asp") ConsoleWrite("_IECreate " & @error & @TAB & @extended & @CRLF) Local $oForm = _IEFormGetObjByName($oIE, "webForm") ConsoleWrite("_IEFormGetObjByName " & @error & @TAB & @extended & @CRLF) Local $oSelect = _IEFormElementGetObjByName($oForm, "myDropDownList") ConsoleWrite("_IEFormElementGetObjByName " & @error & @TAB & @extended & @CRLF) _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, "200", 1, "byText") ConsoleWrite("byText " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEFormElementOptionSelect($oSelect, "300", 1, "byValue") ConsoleWrite("byValue " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEFormElementOptionSelect($oSelect, 0, 1, "byIndex") ConsoleWrite("byIndex " & @error & @TAB & @extended & @CRLF) Sleep(1000) _IEQuit($oIE) and post the output from Sciteconsole. Thank You! It worked like a charm! Link to comment Share on other sites More sharing options...
AutoBert Posted June 27, 2016 Share Posted June 27, 2016 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