Jump to content

WebDriver UDF - Help & Support (II)


Danp2
 Share

Recommended Posts

You are great! i figured it out with your help :)))))

Local $sElement
Sleep (2000)
    ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
    ConsoleWrite("TopWindow=" & _WD_IsWindowTop($sSession) & @CRLF)
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@name='_blank']")
    _WD_FrameEnter($sSession, $sElement)
    ConsoleWrite("TopWindowaaaaaaaaaaaaaaa=" & _WD_IsWindowTop($sSession) & @CRLF)

    Local Const $CTG = "//input[@id='katigoria_input']"
 $CTG1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $CTG)
        _WD_ElementAction($sSession, $CTG1, 'value', "CTG")
    _WD_LoadWait($sSession, 0)



    _WD_FrameLeave($sSession)
    ConsoleWrite("TopWindowbbbbbbbbbbbbbbbbbbbbbbbb=" & _WD_IsWindowTop($sSession) & @CRLF)

 

Link to comment
Share on other sites

No... _WD_ElementAction will read an element's attributes or properties, but it doesn't offer a mechanism to update them (because it's not in the W3C specs).

You should be able to do it with _WD_ExecuteScript. Figure out how to do it using Javascript in the browser's Developer Tools console. Once you have the correct syntax, then translate that for use in _WD_ExecuteScript.

Link to comment
Share on other sites

Hey i am just trying to figure it out!

is this the right way to pass js in Execute Script? 

_WD_ExecuteScript($sSession,$sScript['$('#ypalliloi_panel:first-child').attr("id");,$sArguments="[]"[,$lAsync = False]]')

Thank you! 

By the way, i did copy the full xpath so i replaced imagesearch which i was using earlier for the buttons i asked! Thanks again!

Link to comment
Share on other sites

1 hour ago, chrisgreece said:

is this the right way to pass js in Execute Script?

No... Like I said before, first figure out how to accomplish this (assuming it's even possible) using the browser's console. Then you should be able to convert that for use with _WD_ExecuteScript.

Also, please stop with this stuff --> $sArguments="[]"[,$lAsync = False]. That's from the function header, which shows the proper syntax. The square brackets indicate that the parameter is optional. When calling the function, either leave out the parameter all together or supply an appropriate value.

Some examples --

_WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');")

_WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');", Default, False)

_WD_ExecuteScript($sSession,"$('#ypalliloi_panel:first-child').attr('id');", "[]")

Each one of these performs the exact same thing, since the 2nd and 3rd example simply supply the default value for the optional parameter.

For examples of how to properly pass an element as a script argument, see _WD_SelectFiles and _WD_GetShadowRoot in wd_helper.au3.

Link to comment
Share on other sites

Hello @Danp2

Hope you doing well. 

 

Could you help me to target these elements please ? 

 

I'm in trouble because i know how to target like that

$sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@aria-label='Savage']") ; Serveur savage
   _WD_ElementAction($sSession, $sElement00001 , 'click' )

But I don't know how to do when I have these sources : 

<div class="name-3_Dsmg">💻sécurité</div>

<div class="name-3_Dsmg">🌍douane</div>

How could I do to make the difference between them ? Do I have to use the same syntax ?

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

Hi thanks for helping :) 

 

@Nine Any exemple ? 

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

It's discord windows in browser. 

image.thumb.png.d419c77cb90147c24d9a1ba99e6b0628.png

If I want to click on "douane" or "sécurité"

Do you need any more info ?

My last failed attemp

$sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@aria-label='Savage']") ; Serveur savage
   _WD_ElementAction($sSession, $sElement00001 , 'click' )
Sleep(800)
;~    Local $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='name-3_Dsmg']/douane","",True)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='name-3_Dsmg']")
   $sElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//douane", $sElement, True)
   _WD_ElementAction($sSession, $sElements , 'click' )

 

 

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

This doesn't work

$sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='content-3at_AU']/div") ; Serveur savage
   _WD_ElementAction($sSession, $sElement00001 , 'click' )

May you help better with this ? Look in this picture both are close each of other.

image.thumb.png.2482468644ce625786633749ce1318f0.png

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

$sName = "douane"
   $sElement00001 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[contains(text(), '" & $sName & "')]") ; Serveur savage
   _WD_ElementAction($sSession, $sElement00001 , 'click' )

This work thanks ! :) 

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

Yep correct, Ok, where 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

  • 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...