avechuche Posted June 27, 2015 Share Posted June 27, 2015 Hello, I have this function to get an object by class name. The problem I have is that some pages works, but not in others: S, to which it should? I use IE11 in W8.1 x64. Thx!expandcollapse popupFunc _getElementsByClassName(ByRef $oObject, $sClassName, $iIndex = -1) If Not IsObj($oObject) Then __IEConsoleWriteError("Error", "_getElementsByClassName", "$_IESTATUS_InvalidDataType") Return SetError($_IESTATUS_InvalidDataType, 1, 0) EndIf ; If Not __IEIsObjType($oObject, "browserdom") Then __IEConsoleWriteError("Error", "_getElementsByClassName", "$_IESTATUS_InvalidObjectType") Return SetError($_IESTATUS_InvalidObjectType, 1, 0) EndIf Local $oTemp If __IEIsObjType($oObject, "documentcontainer") Then $oTemp = _IEDocGetObj($oObject) Else $oTemp = $oObject EndIf $iIndex = Number($iIndex) Select Case $iIndex = -1 Return SetError($_IESTATUS_Success, $oTemp.GetElementsByClassName($sClassName).length, _ $oTemp.GetElementsByClassName($sClassName)) Case $iIndex > -1 And $iIndex < $oTemp.GetElementsByClassName($sClassName).length Return SetError($_IESTATUS_Success, $oTemp.GetElementsByClassName($sClassName).length, _ $oTemp.GetElementsByClassName($sClassName).item($iIndex)) Case $iIndex < -1 __IEConsoleWriteError("Error", "_getElementsByClassName", "$_IESTATUS_InvalidValue", "$iIndex < -1") Return SetError($_IESTATUS_InvalidValue, 3, 0) Case Else __IEConsoleWriteError("Error", "_getElementsByClassName", "$_IESTATUS_NoMatch") Return SetError($_IESTATUS_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both EndSelect EndFunc ;==>_getElementsByClassName 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