Skip to content

Expand _WD_FrameList with additional parameters #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Danp2 opened this issue Feb 22, 2023 · 10 comments · Fixed by #456
Closed

Expand _WD_FrameList with additional parameters #420

Danp2 opened this issue Feb 22, 2023 · 10 comments · Fixed by #456
Assignees
Labels
enhancement New feature or request

Comments

@Danp2
Copy link
Owner

Danp2 commented Feb 22, 2023

btw. I have also a plan to:
Add support for checking all frames in _WD_LoadWait but firstly 362 _WD_FrameList must be merged.

Originally posted by @mlipok in #385 (comment)

@Danp2 Danp2 added the enhancement New feature or request label Feb 22, 2023
@mlipok
Copy link
Contributor

mlipok commented Mar 7, 2023

Currently _WD_FrameList() in the internal function __WD_FrameList_Internal() already uses _WD_LoadWait().

au3WebDriver/wd_helper.au3

Lines 853 to 868 in f241f2b

Func __WD_FrameList_Internal($sSession, $sLevel, $sFrameAttributes, $bIsHidden, $iDebugLevel)
Local Const $sFuncName = "__WD_FrameList_Internal"
Local Const $sParameters = 'Parameters: Level=' & $sLevel & ' IsHidden=' & $bIsHidden ; intentionally $sFrameAttributes is not listed here to not put too many data into the log
Local $iErr = $_WD_ERROR_Success
Local $vResult = '', $s_URL = '', $sMessage = '', $sCurrentBody_ElementID = ''
_WD_FrameEnter($sSession, $sLevel)
$iErr = @error
If @error Then
$sMessage = 'Error occurred on "' & $sLevel & '" level when trying to entering frame'
Else
_WD_LoadWait($sSession, 100, 5000, Default, $_WD_READYSTATE_Complete)
$iErr = @error
If @error And @error <> $_WD_ERROR_Timeout Then
$sMessage = 'Error occurred on "' & $sLevel & '" level when waiting for a browser page load to complete'
Else

So can we use this feature and parametrize usage of _WD_LoadWait() within _WD_FrameList() ?

ps. assign this issue to me.

@Danp2
Copy link
Owner Author

Danp2 commented Mar 7, 2023

So can we use this feature and parametrize usage of _WD_LoadWait() within _WD_FrameList() ?

I don't understand what it is you want to do here. Can you explain further please?

@mlipok
Copy link
Contributor

mlipok commented Mar 7, 2023

In line 864

au3WebDriver/wd_helper.au3

Lines 860 to 868 in f241f2b

$iErr = @error
If @error Then
$sMessage = 'Error occurred on "' & $sLevel & '" level when trying to entering frame'
Else
_WD_LoadWait($sSession, 100, 5000, Default, $_WD_READYSTATE_Complete)
$iErr = @error
If @error And @error <> $_WD_ERROR_Timeout Then
$sMessage = 'Error occurred on "' & $sLevel & '" level when waiting for a browser page load to complete'
Else

w are already using _WD_LoadWait() function thus _WD_FrameList() waiting for each frame.

I think we can use this part of code by adding few parameters to _WD_FrameList()
Something like

Func _WD_FrameList($sSession, $bReturnAsArray = True, $iDelay = Default, $iTimeout = Default, $sElement = Default, $iState = Default)

and in this way make it easy to solve this Issue/FeatureRequest Check frames in _WD_LoadWait

What you think about ?

@Danp2
Copy link
Owner Author

Danp2 commented Mar 7, 2023

I'm still not following your logic. The issue's title is "Check frames in _WD_LoadWait", so I was expecting a proposal where _WD_LoadWait was modified to perform additional steps. This doesn't appear to be the case. Hence, my confusion.

@mlipok
Copy link
Contributor

mlipok commented Mar 7, 2023

I was expecting a proposal where _WD_LoadWait was modified to perform additional steps.

ok, lets split your expectation to 2 separate steps

STEP 1. perform additional steps

I'm talking here that this additional steps can be just to use:

Func _WD_FrameList($sSession, $bReturnAsArray = True, $iDelay = Default, $iTimeout = Default, $sElement = Default, $iState = Default)

STEP 2. proposal where _WD_LoadWait was modified

in a future as a one of next step just after the first one

@Danp2
Copy link
Owner Author

Danp2 commented Mar 7, 2023

Here's what I'm thinking without putting too much effort into it --

  • It seems like you want to use _WD_FrameList to perform a task that is outside it's intended purpose.
  • It doesn't make sense to me to have _WD_LoadWait call _WD_FrameList, which then turns around and calls _WD_LoadWait
  • Perhaps we shouldn't be modifying _WD_LoadWait at all, and instead add a separation function to perform this new action.
  • Would it help to gather the loading status of each frame into the array produced by _WD_FrameList?

@mlipok
Copy link
Contributor

mlipok commented Mar 7, 2023

  • It seems like you want to use _WD_FrameList to perform a task that is outside it's intended purpose.

It already uses _WD_LoadWait to get better results, We can add few additionall parameters:

Func _WD_FrameList($sSession, $bReturnAsArray = True, $iDelay = Default, $iTimeout = Default, $sElement = Default, $iState = Default)

To give user a possibility to decide how long he want to wait.

  • It doesn't make sense to me to have _WD_LoadWait call _WD_FrameList, which then turns around and calls _WD_LoadWait

it is requrent calls for each separate frame and sub frames

  • Perhaps we shouldn't be modifying _WD_LoadWait at all, and instead add a separation function to perform this new action.

ok, lets keep hand off from _WD_LoadWait
and instead just add few additionall parameters:

Func _WD_FrameList($sSession, $bReturnAsArray = True, $iDelay = Default, $iTimeout = Default, $sElement = Default, $iState = Default)

This will lead to what I said before: To give user a possibility to decide how long he want to wait.

Would it help to gather the loading status of each frame into the array produced by _WD_FrameList?

using $_WD_READYSTATE_*** and this:

$sReadyState = _WD_ExecuteScript($sSession, 'return document.readyState', '', Default, $_WD_JSON_Value)

?

@Danp2
Copy link
Owner Author

Danp2 commented Mar 7, 2023

ok, lets keep hand off from _WD_LoadWait and instead just add few additional parameters:

Func _WD_FrameList($sSession, $bReturnAsArray = True, $iDelay = Default, $iTimeout = Default, $sElement = Default, $iState = Default)

I'm good with not touching _WD_LoadWait. I think you should evaluate each of the proposed new parameters for _WD_FrameList. For example --

  • $iDelay - Does this occur only once at the beginning of the function or for each frame?
  • $iTimeout - Is this per frame or for the entire function call?
  • $sElement - This one makes no sense IMO

using $WD_READYSTATE*** and this:$sReadyState = _WD_ExecuteScript($sSession, 'return document.readyState', '', Default, $_WD_JSON_Value)

Yes. But it appears that _WD_LoadWait already set @Extended to the index of $aWD_READYSTATE, so you should be able to use this information without having to call _WD_ExecuteScript again.

@Danp2 Danp2 changed the title Check frames in _WD_LoadWait Expand _WD_FrameList with additional parameters Mar 7, 2023
@mlipok
Copy link
Contributor

mlipok commented Mar 8, 2023

I'm good with not touching _WD_LoadWait. I think you should evaluate each of the proposed new parameters for _WD_FrameList. For example --

  • $iDelay - Does this occur only once at the beginning of the function or for each frame?

IMO should occurs only once.
Will check it.

  • $iTimeout - Is this per frame or for the entire function call?

IMO per frame.
Will check it.

  • $sElement - This one makes no sense IMO

You have right there is no sens for this,

as a side note: I just copy paste parameters from other function to show POC - proof of concept ;)

using $WD_READYSTATE*** and this:$sReadyState = _WD_ExecuteScript($sSession, 'return document.readyState', '', Default, $_WD_JSON_Value)

Yes. But it appears that _WD_LoadWait already set @Extended to the index of $aWD_READYSTATE, so you should be able to use this information without having to call _WD_ExecuteScript again.

oh. thanks for pointing me to this.

@mlipok
Copy link
Contributor

mlipok commented Mar 8, 2023

but before we do next step

in first step please focus on:
#434

and then
#433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants