Jury Posted April 3, 2022 Posted April 3, 2022 I'm try to convert my IE function to work in Webdriver is it possible to set values by index as my old script did: #include <Date.au3> #include <IE.au3> #include <Inet.au3> Global $NZLIIcite, $oIEs $oIEs = _IECreate("http://www.austlii.edu.au/techlib/usermark/", 1, 0) $citation = '[2018] NZHC 1059' IsOn($citation) If $NZLIIcite = "y" Then ConsoleWrite($NZLIIcite &' '&$citation & @CRLF) Else ConsoleWrite('not on ' & $NZLIIcite &' '&$citation & @CRLF) EndIf Func IsOn($ncn) _IENavigate($oIEs, "http://www.austlii.edu.au/techlib/usermark/") Local $oForm = _IEFormGetCollection($oIEs, 0) Local $oText = _IEFormElementGetObjByName($oForm, "usertxt") _IEFormElementSetValue($oText, $ncn) _IEFormElementRadioSelect($oForm, 1, "userjur", 1, "byIndex") _IEFormElementCheckBoxSelect($oForm, 0, "findcases", 0, "byIndex") _IEFormElementCheckBoxSelect($oForm, 1, "findcases", 1, "byIndex") _IEFormElementCheckBoxSelect($oForm, 2, "findcases", 0, "byIndex") _IEFormElementCheckBoxSelect($oForm, 3, "findcases", 0, "byIndex") _IEFormSubmit($oForm, 0) Sleep(1000) Local $sHTML = _IEBodyReadHTML($oIEs) If StringInStr($sHTML, "http://www.nzlii.org") Then $NZLIIcite = "y" ;y Else $NZLIIcite = "n" ;n EndIf $sHTML = "" EndFunc ;==>IsOn do I always just use _WD_FindElement ignoring what was the FormGetCollection/GetObjByName code/? If I have to use _WD_SetElementValue how do I SetElementValue for radio and checkboxes?
Danp2 Posted April 4, 2022 Posted April 4, 2022 Yes, you will use _WD_FindElement to obtain the correct Element ID. Then you can use _WD_ElementActionEx to either "check" or "uncheck" the checkbox. You may also be able to do it with _WD_SetElementValue or _WD_ElementAction. Latest Webdriver UDF Release Webdriver Wiki FAQs
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