zzghost Posted January 22, 2019 Posted January 22, 2019 (edited) Hello, I have been reading every tutorial and help document I can find trying to figure out how to capture from a website the content of a dropdown in order to populate it into a GUI with checkboxes to run some code based off of the selections... Quote <select name="ContentPlaceHolder1$selectCtr" id="ContentPlaceHolder1_selectCtr" class="form-group"> <option selected="selected" value="">select ...</option> <option value="8494">Option1(8494)</option> <option value="106209">Option2(106209)</option> </select> I would like a script to read the options from this form-group and populate a gui. I have all the code written except this part, as of now I have to manually pull this from the site and dump into my code but it changes from time to time so I would like my code to be more flexible... Hope this makes sense? Edited January 23, 2019 by zzghost
Danp2 Posted January 22, 2019 Posted January 22, 2019 Have you tried using _IEGetObjByID to get a reference to the select element and then passing this object as the first parameter of _IETagNameGetCollection to get a collection of the option elements? Latest Webdriver UDF Release Webdriver Wiki FAQs
zzghost Posted January 22, 2019 Author Posted January 22, 2019 Please help, I think this is what you meant just trying to teach myself.... #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "selectExample") Local $oInputs = _IETagNameGetCollection($oIE, $oForm) Local $sTxt = "" For $oInput In $oInputs $sTxt &= $oInput.???? & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Test", $sTxt) _IEQuit($oIE)
Danp2 Posted January 23, 2019 Posted January 23, 2019 You've got a few things wrong there. But here's a working example of what I was intending -- #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IE_Example("form") Local $oElement = _IEGetObjByName($oIE, "selectExample") Local $oOptions = _IETagNameGetCollection($oElement, 'option') Local $sTxt = "" For $oOption In $oOptions $sTxt &= $oOption.value & @TAB & $oOption.innerText & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Test", $sTxt) _IEQuit($oIE) Latest Webdriver UDF Release Webdriver Wiki FAQs
jdelaney Posted January 23, 2019 Posted January 23, 2019 _IEFormElementOptionSelect IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Danp2 Posted January 23, 2019 Posted January 23, 2019 That was my initial thought as well, but I don't think you can get the data the OP needs using this function. Latest Webdriver UDF Release Webdriver Wiki FAQs
jdelaney Posted January 23, 2019 Posted January 23, 2019 oops, didn't read the part where they just wanted to get the values. cheers. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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