Jump to content

WebDriver UDF - Help & Support


Recommended Posts

Yeah no problem./ 

I have not any issue it's just i cannot find which element I can choose to play with that element. 

 

@Danp2  Seem like this part is hard to fix with forum help. 

 

hmmmmmmmmmmm 

Maybe there is an other way than Xpath ?

Edit: I understood what is happenning. it s becose i have to click the element before spend string inside it or it doesn't work. I have to find a way to know what is html code of the item in first stat. Then send my string after click.

 

And here I come with an other question then. 

How to wait an element ? 

In my little brain ... to associate an element to a var we have to see it. (or at least he have to exists)

How to do if i know what element i want to wait but i can't get it into a var? I can't figure out the correct process

 

Here is my code so you know but i am hidding professional link they have to stay confidentials:

Func _FindAllElements ()
   $sElement00 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@class='form_input_undefined']") ; Service Numerique
   $sElement0 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='form_input_undefined']") ; Service Numerique
   $sElement4 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='SD_REQUEST.AVAILABLE_FIELD_2']") ; NOM USER
   $sElement5 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='SD_REQUEST.AVAILABLE_FIELD_1']") ; MAIL
   $sElement6 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='SD_REQUEST.AVAILABLE_FIELD_3']") ; TEL
   $sElement7 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='SD_REQUEST.AVAILABLE_FIELD_4']") ; Department
   $sElement8 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='SD_REQUEST.AVAILABLE_FIELD_5']") ; Type
EndFunc

Func _SendInAllElement ()
    _WD_ElementAction($sSession, $sElement00, 'click' )
    _WD_ElementAction($sSession, $sElement0, 'value', ""&$cService )
    _WD_ElementAction($sSession, $sElement4, 'value', ""&$cNom )
    _WD_ElementAction($sSession, $sElement5, 'value', ""&$cEmail )
    _WD_ElementAction($sSession, $sElement6, 'value', ""&$cTel )
    _WD_ElementAction($sSession, $sElement7, 'value', ""&$cDepartment )
    _WD_ElementAction($sSession, $sElement8, 'value', ""&$cType )
EndFunc

Func _StartupWD ()
    SetupChrome()
    _WD_Startup();Demarrage du WebDriver
    $sSession = _WD_CreateSession($sDesiredCapabilities);Option du browser
    _WD_Navigate($sSession, "https://confidential.com");Navigation a Google.com
    $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='url_account']") ; Account
    $sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='url_login']") ; Login
    $sElement3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='url_password']") ; Password
    _WD_ElementAction($sSession, $sElement, 'value', ""&$evAccount)
    _WD_ElementAction($sSession, $sElement2, 'value', ""&$evLogin)
    _WD_ElementAction($sSession, $sElement3, 'value', ""&$evPassword)
    $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@type='submit']")
    _WD_ElementAction($sSession, $sElement1, 'click')
    $sElement0 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@id='link_bookmark_107']") ; Support N1
    _WD_ElementAction($sSession, $sElement0, 'click')
    WinMove("chromedriver.exe","", -1500 , -1500 )
EndFunc

Func SetupChrome()
   _WD_Option('Driver', 'chromedriver.exe')
   _WD_Option('Port', 9515)
   _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
   $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}'
EndFunc

 

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

26 minutes ago, Danp2 said:

Have you taken a look at the function _WD_WaitElement?

Yeah in Wd_Helper but how to wait an element that's not existing yet ?

I guess i have to attach it first with _WD_FindElement no ?

 

EDIT: 

"I guess i am thinking about complicated things when it's just simple as that"

 

I just have to add my $_WD_LOCATOR_ByXPath without attaching the element ? 

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

@caramen Yes, you are over complicating things. Just call _WD_WaitElement in a similar fashion as _WD_FindElement.  If you examine the underlying code, you'll see that it just calls _WD_FindElement in a loop.

FYI, I believe there are some examples of using this function in this thread or the related one.

Link to comment
Share on other sites

5 minutes ago, Danp2 said:

@caramen Yes, you are over complicating things. Just call _WD_WaitElement in a similar fashion as _WD_FindElement.  If you examine the underlying code, you'll see that it just calls _WD_FindElement in a loop.

FYI, I believe there are some examples of using this function in this thread or the related one.

Last question i remember i saw a gettext function somewhere i cannot find it back . it's possible to extract text with WD ?

 

edit: Ah i just find it back it's in _WD_Alerte. But probably not the thing i am looking for ;) .

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

Thanks i will try the text parameter. Thx to point me out :) .

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

wo man that's so powerfull I love it !

It work. 

SO if you guys want the text of any element in your webpage you can use this kind of function. Adapt the xpath to your needs. 

$cText = _GetMyElementTextXPath($sSession,"div","SD_REQUEST_COMMENT1")

MsgBox (0,"My text" , $cText)

Func _GetMyElementTextXPath($sSession,$elementType,$elementName)
    $sElement000000 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//"$elementType"[@name='"&$elementName&"']") ; Get the element
    $cString = _WD_ElementAction($sSession, $sElement000000, 'text' ) ;Insert Text inside my Return $cString
    Return $cString ;Return my text String
EndFunc

 

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

Oh now i improved my script. 

And i feel the need of doing somthing i did'nt find. I watched the wd core and helper the function itself but... How to load a page without wait ?

I mean actually :

1 I navigate somewhere.

2 I take data

3 I open an other tab

4 I navigate to an other page with my data

5 Then it wait till the page load.

6 Then i attach again to my first page.

How to do 6 without 5 ? 

Edit:

Precision : I want to do that only for step 4 not for all the script. 

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

35 minutes ago, Danp2 said:

@caramen Have you tried changing the pageLoad timeout with _WD_Timeouts (see wd_demo for an example)?

oh... was doing _WD_Timeouts($sSession, "500")

Ty again.

Do you got a tip to dile with element I have to move mouse over to see them ? 

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 can show screenshot. About the website i cannot provide the url. It's not intranet but it's 100% confidential. It contain the base of full France country customers.

With personnal info etc...

So the only thing i can do is this :

image.png.b3a423e2257a0a853db7ac2fc9ec0c59.png

The field : "Incident" I need to get the mouse over the field to get this element : 

image.png.8c042a14f00bc06496ac7cc519c584e6.png

And i need to click on it. 

I know the code of the element but everything I tryed do nothing. 

<div class="imgPopup_treeview"

style="display: inline-block;">&nbsp;

</div>

The only working code i have is this but i hate that kind of thing now. 

$xt=271
    $xl=169
    $xb=1017
    $xr=602
    $xtm = $xt
    $xlm = $xl
    $pixel = ""
    $cExitLoopVar = 0
    Do
        $xtm += 15
        $xlm += 15
        $pixel = PixelSearch($xt,$xl , $xb,$xr , 0xCD1104 )
        MouseMove ( $xtm, $xlm )
        If IsArray ($pixel) Then $cExitLoopVar = 1
    Until $cExitLoopVar = 1
    MouseClick ("left" , $pixel[0]+30,$pixel[1] , 1 , 0 )

 

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

Ok Thanks. 

My final question is there is somthing already make to hide the webdriver from taskbar ? 

Can you final point me out for it :D ? 

 

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

Man i asked lot thing at same time thx for all :) 

I 'll try this WD action and come after several try.

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

Can you say me where to get information about these parameters ? 
 

$sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"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

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...