Jump to content

WebDriver UDF - Help & Support (II)


Danp2
 Share

Recommended Posts

2 minutes ago, Nine said:

Verify if you got a frame embedding this element.

Explain me please ?

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

19 minutes ago, Nine said:

Verify if you got a frame embedding this element.

 @Nine I can see that in the root source code of this page

image.png.cf3a4cf5d3b35663ff2270939c1c8bf6.png

How to work with frames ?

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I got this return, but It does not rly help me

_WD_ExecuteScript: {"value":4}...
Frames=4
_WD_ExecuteScript: {"value":true}...
TopWindow=True

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen Perhaps this revised example will help you --

Func DemoFrames()
    Local $sElement

    _WD_Navigate($sSession, "https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe")
    ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='iframeResult']")
    _WD_FrameEnter($sSession, $sElement)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe")
    _WD_FrameEnter($sSession, $sElement)
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@id='w3loginbtn']")
    _WD_ElementAction($sSession, $sButton, 'click')
    _WD_LoadWait($sSession, 2000)
    _WD_FrameLeave($sSession)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    _WD_FrameLeave($sSession)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
EndFunc

 

Link to comment
Share on other sites

I see nothing happen on the website... bro It's me that is retarded again lol 😛 ?

Ah I had to add sleep to accept cookies, and then I see it push log in button.

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Okok. So If I don't understand the way it works, how, and where to start ?

What do I have to understand ? 

What is a Frame concretely ? 

 

From now, I understand that the syntax is correct.

But I cannot find the element because he is hidden by the frame or something like that ?

So I understand I have to touch the frame before touching the element ? 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen You can't interact with an element until you switch to the correct browsing context. You can switch browsing contexts using _WD_Window. You can also use the helper functions _WD_FrameEnter & _WD_FrameLeave, which call _WD_Window behind the scenes.

Please remember that this is the Webdriver UDF support thread. Since your question is of a general nature and not Webdriver specific, you may want to start a separate thread dealing with website frames.

 

Link to comment
Share on other sites

4 hours ago, Danp2 said:

@caramen You can't interact with an element until you switch to the correct browsing context. You can switch browsing contexts using _WD_Window. You can also use the helper functions _WD_FrameEnter & _WD_FrameLeave, which call _WD_Window behind the scenes.

Please remember that this is the Webdriver UDF support thread. Since your question is of a general nature and not Webdriver specific, you may want to start a separate thread dealing with website frames.

 

Now I got it. These functions are like lever/

Sorry about the out of context question I thought that was in your scope. 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Lesson learned ! 😛 thanks guys. 

 

Func EnvoyerInfoMasque ()
            Local $sFrame = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//frame[@id='main']")
            ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
            ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
            _WD_FrameEnter($sSession, $sFrame)
            ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
            $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//textarea[contains(@id,'icmtDE_SYMPAPPEL')]")

            _WD_ElementAction($sSession, $sElement, 'text', 'Caraxxx@hotmail.com1' )
            _WD_ElementAction($sSession, $sElement, 'value', 'Caraxxx@hotmail.com1' )

            _WD_LoadWait($sSession, 2000)
            _WD_FrameLeave($sSession)
EndFunc

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

3 minutes ago, caramen said:

_WD_ElementAction($sSession, $sElement, 'text', 'Caraxxx@hotmail.com1' )

The 'text' option only retrieves the element text, not set it. Therefore, this line isn't doing anything and can be eliminated.

Quote

_WD_LoadWait($sSession, 2000)

Don't see why this would be needed here.

Link to comment
Share on other sites

1 minute ago, Danp2 said:
Quote

_WD_LoadWait($sSession, 2000)

Don't see why this would be needed here.

On 1/6/2021 at 1:47 AM, Danp2 said:

this revised example

You did that in the example, I just did same. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

 If i have the array of handles, is there a way of getting the HTML titles or URLs from those handles without switching to them?

I know i can _WD_Window switch, then _WD_Action($sSession,"title") to get the titles once i switch...but I was hoping i might be able to pass a handle to _WD_Action to get the title without switching the visual pane.

Link to comment
Share on other sites

There's a webpage that i'm trying to automate, and when a certain step is taken, it launches an unecessary pop up. I don't want to disable all pop ups for the browser, I just want to locate this pop up, get a handle to it, and close it.

Link to comment
Share on other sites

I would do it like this --

  • Save the current tab's handle
  • Use _WD_Attach to temporarily switch to the popup window
  • Use _WD_Window to close the popup
  • Switch back to the original tab using the saved handle

Another option would be something like this --

  • Save the current tab's handle
  • Gather the list of current handles
  • Perform the action that produces the popup
  • Gather the list of current handles (2nd time)
  • Compare the two sets of handles and close any that don't exist in the initial set
  • Switch back to the original tab using the saved handle
Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...