-
Notifications
You must be signed in to change notification settings - Fork 23
Add _WD_LocateElement #386
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
Conversation
@Danp2 |
Please check it with modified wd_demo.au3 |
I did. Unfortunately, it doesn't work for me. This is what I get in the logs --
|
And this are correct result. |
OIC. I misinterpreted the results by assuming that "null" was incorrect. |
So I assume that now you understand that 'null' is correct result as this is exact location for this element, as it is located on top window |
@mlipok Some feedback on this PR --
|
When non advance user is using HTML DOM structure in browser DevTools to find element by XPATH or by CSSQuerySelector they do not bother about frames as because browser find them just a way. You can even teach user how to use browser to check if there are frames. But how would you like to pass the way of identifying a particular frame to the format required by If user say my XPATH works in browser but not with |
btw. |
Multiple matching is good point. And will be added soon in this PR. Hidden/Disabled that is not our concern. We only finding element locations. I can compare it to |
My observation:
My new proposals for function name are: |
try to use: _WD_Navigate($sSession, "https://www.tutorialspoint.com/html/html_frames.htm#")
_WD_ELementExist($sSession, $_WD_LOCATOR_ByCSSSelector, "li.nav-item[data-bs-original-title='Home Page'] a.nav-link[href='https://www.tutorialspoint.com/index.htm']") |
It's been a while since I've had to work with frames, but IIRC I always located the frame first with _WD_FindElement and then passed the Element ID to _WD_Window / _WD_FrameEnter.
Only the last one has any chance of approval. 😉 Another for consideration is _WD_FindElementFrames. |
|
I had today an issue related to frames which I solve using |
So is it now clear to you what is the purpose of this function ? |
I tried running your revised demo, but it didn't complete successfully --
The error seems to originate on this line -- Line 828 in 0eb6cc9
|
I understand what it does. It just doesn't feel "natural" to me since I've never located a frame in that manner. |
I am not surprised as the ability to specify a path is a new feature ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlipok Did you miss this? #386 (comment)
WIP |
When I perform test then I have many issues with internet connectivity. |
do you still have this? |
Yes
Still occurs |
Here is short script to reproduce the issue -- SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://www.tutorialspoint.com/html/html_frames.htm")
_WD_LoadWait($sSession)
_WD_FrameEnter($sSession, 0)
Local $iCount = _WD_GetFrameCount($sSession) ; $iCount = 3
;### Debug CONSOLE ↓↓↓
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iCount = ' & $iCount & @CRLF & '>Error code: ' & @error & @CRLF)
_WD_ExecuteScript($sSession, "return document.querySelectorAll('iframe')[0].outerHTML;") ; JS error
_WD_ExecuteScript($sSession, "return document.querySelectorAll('iframe')[0];") ; ResponseText={"value":null}
$result = _WD_ExecuteScript($sSession, "return document.querySelectorAll('iframe');") ; $result = {"value":[]}
;### Debug CONSOLE ↓↓↓
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result & @CRLF & '>Error code: ' & @error & @CRLF) Here's the console output --
|
Analyzing. |
I have already done this function but there is too many conflict. |
Pull request
Proposed changes
There should be easy way to find element location in the frame list returned by
_WD_FrameList
Checklist
Types of changes
Please check
x
the type of change your PR introduces:What is the current behavior?
No easy way to find element location in the frame list because
_WD_FindElement
finds element only in current location ( main document or desired frame selected by_WD_FrameEnter
)What is the new behavior?
It shoul be easie with
_WD_ElementExist
Additional context
This was initially discussed here:
#362 (comment)
and here
#362 (comment)
System under test
not related