Danp2 / au3WebDriver

Web Driver UDF for AutoIt
MIT License
108 stars 23 forks source link

wd_demo.au3: checking "UserFile" and _WD_GetContext() #461

Closed mlipok closed 1 year ago

mlipok commented 1 year ago

Bug report

Describe the bug

I was intend to check how _WD_GetContext() works, in order to continue work on https://github.com/Danp2/au3WebDriver/issues/369

How to reproduce

use wd_demo.au3 with UserFile feature, to run file usertesting_WD_GetContext.au3 (create on your disc with this following content)

$sArrayHeader = 'Absolute Identifiers > _WD_FrameEnter|Relative Identifiers > _WD_FrameEnter|FRAME attributes|URL|Body ElementID|IsHidden|MatchedElements'

_Demo_NavigateCheckBanner($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe", '//*[@id="snigel-cmp-framework" and @class="snigel-cmp-framework"]')
ConsoleWrite("! 1" & @CRLF)

$CONTEXT = _WD_GetContext($sSession)
ConsoleWrite("! 2" & @CRLF)

$a_FrameTest = _WD_FrameList($sSession)
ConsoleWrite("! 3" & @CRLF)

_ArrayDisplay($a_FrameTest, 'Starting', 0, 0, Default, $sArrayHeader)
ConsoleWrite("! 4" & @CRLF)

_WD_FrameEnter($sSession, 'null/0')
ConsoleWrite("! 5" & @CRLF)

$a_FrameTest = _WD_FrameList($sSession)
ConsoleWrite("! 6" & @CRLF)

_ArrayDisplay($a_FrameTest, 'null/0', 0, 0, Default, $sArrayHeader)
ConsoleWrite("! 7" & @CRLF)

_WD_FrameEnter($sSession, $CONTEXT)
ConsoleWrite("! 8" & @CRLF)

$a_FrameTest = _WD_FrameList($sSession)
ConsoleWrite("! 9" & @CRLF)

_ArrayDisplay($a_FrameTest, '$CONTEXT', 0, 0, Default, $sArrayHeader)
ConsoleWrite("! 10" & @CRLF)

I get unexpected results:

+ wd_demo.au3: Running: UserFile
__WD_Post ==> Success [0] : HTTP status = 200
_WD_Navigate ==> Success [0] : Parameters:   URL=https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe
_WD_LoadWait ==> Success [0 / 4] : Parameters:    Delay=Default    Timeout=Default    Element=Default    DesiredState=complete    : ReadyState= complete (Fully loaded)
_WD_WaitElement ==> Success [0] : Parameters:   Strategy=xpath   Selector=//*[@id="snigel-cmp-framework" and @class="snigel-cmp-framework"]   Delay=0   Timeout=60000   Options=8
_WD_LoadWait ==> Success [0 / 4] : Parameters:    Delay=Default    Timeout=Default    Element=Default    DesiredState=complete    : ReadyState= complete (Fully loaded)
! 1
! 2
! 3
! 4
__WD_Post ==> Success [0] : HTTP status = 200
_WD_Window ==> Success [0] : Parameters:   Command=frame   Option={"id":null}
__WD_Post ==> Success [0] : HTTP status = 200
_WD_Window ==> Success [0] : Parameters:   Command=frame   Option={"id":0}
_WD_FrameEnter ==> Success [0] : Parameters:    Identifier=null/0
! 5
! 6
! 7
! 8
! 9
! 10
+ wd_demo.au3: Finished: UserFile

Expected behavior

  1. be able to use _ArrayDisplay() to display the results
  2. be able to check how _WD_GetContext() works

Screenshots

none

Additional context

this is first step to continue work on https://github.com/Danp2/au3WebDriver/issues/369

System under test

not related

Danp2 commented 1 year ago
mlipok commented 1 year ago

usertesting_WD_GetContext.au3 modified a little in OP.

mlipok commented 1 year ago

So for now we can only do

ConsoleWrite("! 2" & _WD_GetContext($sSession) & @CRLF)

instead

$CONTEXT = _WD_GetContext($sSession)
mlipok commented 1 year ago

I have a work around in tests.