Jump to content

Recommended Posts

Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...