Skip to content

Commit

Permalink
Fix error in _WD_FrameEnter (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danp2 authored May 23, 2023
1 parent 820a83e commit 9e0bc7b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Go to [legend](#legend---types-of-changes) for further information about the types of changes.

## [Unreleased]
## [1.0.1] 2023-05-23

### Fixed

- _WD_FrameEnter: Remove GUID validation

### Project

Expand Down Expand Up @@ -1090,7 +1094,8 @@ _WD_CapabilitiesDisplay
- Initial release


[Unreleased]: https://github.com/Danp2/au3WebDriver/compare/1.0.0...HEAD
[Unreleased]: https://github.com/Danp2/au3WebDriver/compare/1.0.1...HEAD
[1.0.1]: https://github.com/Danp2/au3WebDriver/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/Danp2/au3WebDriver/compare/0.13.0...1.0.0
[0.13.0]: https://github.com/Danp2/au3WebDriver/compare/0.12.0...0.13.0
[0.12.0]: https://github.com/Danp2/au3WebDriver/compare/0.11.0...0.12.0
Expand Down
46 changes: 19 additions & 27 deletions wd_helper.au3
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ EndFunc ;==>_WD_IsWindowTop
; Return values .: Success - True.
; Failure - WD Response error message (E.g. "no such frame") and sets @error to one of the following values:
; - $_WD_ERROR_Exception
; - $_WD_ERROR_InvalidArgue
; Author ........: Decibel
; Modified ......: Danp2, mLipok, jchd
; Remarks .......: You can drill-down into nested frames by calling this function repeatedly or use identifier like 'null/2/0'
Expand All @@ -729,34 +728,27 @@ Func _WD_FrameEnter($sSession, $vIdentifier)
ElseIf IsInt($vIdentifier) Then
$sOption = '{"id":' & $vIdentifier & '}'
Else
_WinAPI_GUIDFromString("{" & $vIdentifier & "}")
If @error Then
$iErr = $_WD_ERROR_InvalidArgue
Else
$sOption = '{"id":' & __WD_JsonElement($vIdentifier) & '}'
EndIf
$sOption = '{"id":' & __WD_JsonElement($vIdentifier) & '}'
EndIf

If $iErr = $_WD_ERROR_Success Then ; check if $vIdentifier was succesfully validated
If Not $bIdentifierAsPath Then
$sResponse = _WD_Window($sSession, "frame", $sOption)
$iErr = @error
Else
Local $aIdentifiers = StringSplit($vIdentifier, '/')
For $i = 1 To $aIdentifiers[0]
If String($aIdentifiers[$i]) = 'null' Then
$aIdentifiers[$i] = '{"id":null}'
Else
$aIdentifiers[$i] = '{"id":' & $aIdentifiers[$i] & '}'
EndIf
$sResponse = _WD_Window($sSession, "frame", $aIdentifiers[$i])
If Not @error Then ContinueLoop
If Not $bIdentifierAsPath Then
$sResponse = _WD_Window($sSession, "frame", $sOption)
$iErr = @error
Else
Local $aIdentifiers = StringSplit($vIdentifier, '/')
For $i = 1 To $aIdentifiers[0]
If String($aIdentifiers[$i]) = 'null' Then
$aIdentifiers[$i] = '{"id":null}'
Else
$aIdentifiers[$i] = '{"id":' & $aIdentifiers[$i] & '}'
EndIf
$sResponse = _WD_Window($sSession, "frame", $aIdentifiers[$i])
If Not @error Then ContinueLoop

$iErr = @error
$sMessage = ' Error on ID#' & $i & ' > ' & $aIdentifiers[$i]
ExitLoop
Next
EndIf
$iErr = @error
$sMessage = ' Error on ID#' & $i & ' > ' & $aIdentifiers[$i]
ExitLoop
Next
EndIf

If $iErr = $_WD_ERROR_Success Then
Expand All @@ -769,7 +761,7 @@ Func _WD_FrameEnter($sSession, $vIdentifier)
Else
$sValue = True
EndIf
ElseIf $iErr <> $_WD_ERROR_InvalidArgue And Not $_WD_DetailedErrors Then
ElseIf Not $_WD_DetailedErrors Then
$iErr = $_WD_ERROR_Exception
EndIf

Expand Down

0 comments on commit 9e0bc7b

Please sign in to comment.