Jump to content

WebDriver UDF (W3C compliant version) - 2024/09/21


Danp2
 Share

Recommended Posts

Hey,

on my way to use the webdriver it shows me errors.

on running he wd_demo it says

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_helper.au3"    
"C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_helper.au3" (1246) : ==> Duplicate function name.:
Func _Base64Decode($input_string)

if i deleat  the part in the wd_helper it runs the demo ui.

if i now choose any point from the demo und run it it says:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_demo.au3"    
_WDStartup: OS:    WIN_10 WIN32_NT 17763
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.2.0.5
_WDStartup: WinHTTP:    1.6.4.1
_WDStartup: Driver:    geckodriver.exe
_WDStartup: Params:    --log trace
_WDStartup: Port:    4444
_WD_Startup ==> General Error: Error launching web driver!
>Exit code: 4294967295    Time: 14.86

 

whats wron with it?

Link to comment
Share on other sites

Did you install geckodriver on a network drive?
If yes, please have a look at the wiki.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Hi Water,

i aint got no networkdrives, and im trying to use the demo with chrome due to i wanna run the scripts with chrome

 

seems like i missed to add the chromedriver.ee to the scriptfolder.

 

now there is another error.

 

if i run the democode it tells me

"C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_helper.au3" (1246) : ==> Duplicate function name.:
Func _Base64Decode($input_string)

if i take this part out of the helper.au3 its goeing a step further.

on opening the webdriverdemo i choose chrome and eg demodownload or demoaction it justs open a blanc website in chrome and ends with the msg

 

wd_core.au3" (332) : ==> Unknown function name.:
Local $oJSON = Json_Decode($sResponse)
Local $oJSON = ^ ERROR
>Exit code: 1    Time: 74.36

 

chromedriver.exe shows

[7172:3796:0123/130553.569:ERROR:ppapi_thread.cc(317)] Failed to load Pepper module from internal-not-yet-present (error: 126)

 

 

 

Edited by svenjatzu
Link to comment
Share on other sites

As describd in the Requirements section of the wiki you still need Microsoft Visual Studio redistributable installed on your system.
And your version of Firefox needs to be ≥ 60.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Did you insall the 32 or 64 bit version of the geckodriver?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

13 minutes ago, water said:

As describd in the Requirements section of the wiki you still need Microsoft Visual Studio redistributable installed on your system.
And your version of Firefox needs to be ≥ 60.

Any special version or doesnt it matter?

Link to comment
Share on other sites

Don't know. I would use the latest.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

1 hour ago, svenjatzu said:

on running he wd_demo it says

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_helper.au3"    
"C:\Users\User\Desktop\WebDriver-0.2.0.5\wd_helper.au3" (1246) : ==> Duplicate function name.:
Func _Base64Decode($input_string)

This function should only be present in wd_helper.au3. You need to determine where the other instance of this function is being defined.

Quote

do i need gecko for chrome?

No, but it won't hurt if you have it present.

Link to comment
Share on other sites

Hi!

I'm trying to click in a button to open a client profile, using this:

SetupChrome()
_WD_Startup()

ConsoleWrite("Start" & @CRLF)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='client35']/a")
ConsoleWrite("Test: ")
ConsoleWrite($sElement & @CRLF)
If $sElement <> "" Then _WD_ElementAction($sSession, $sElement, 'click')_Click($sElement)

This is what i get:

Start
"C:\Program Files (x86)\AutoIt3\Include\WinHttp.au3" (2372) : ==> Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.:
Func __WinHttpDefault(ByRef $vInput, $vOutput)

 

If it is useful:

 <a href="javascript:;" onclick="Open_client35">Client 35</a>

 

Why this happens?

Thanks!

 

Link to comment
Share on other sites

28 minutes ago, pubeoutros said:

"C:\Program Files (x86)\AutoIt3\Include\WinHttp.au3" (2372) : ==> Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.:
Func __WinHttpDefault(ByRef $vInput, $vOutput)

Haven't seen that one before. Can you post the full results from the Scite output panel? Also, a short reproducer script would be nice. 😀

Edit: If you are changing the default setting of $_WD_DEBUG, please set it equal to $_WD_DEBUG_Info so that the logging detail is at a maximum

Edited by Danp2
Link to comment
Share on other sites

34 minutes ago, Danp2 said:

Haven't seen that one before. Can you post the full results from the Scite output panel? Also, a short reproducer script would be nice. 😀

Right now i can't the server is offline, monday i will test and put here.

Another question, there are some buttons that needs a mouseouver or focus to be able to click in it.

Very noob question:

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $Item)
$sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}'

$Script = 'document.onmouseover'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

$Script = 'document.focus()'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

_WD_ElementAction($sSession, $sElement, 'click')

I tried this but doesn't work, in my opinion the "document" should be the problem, but i don't know what to put there.

Btw: I know that i could put the $Script right in the $sResponse line, but to test i'm using that way.

Edited by pubeoutros
Link to comment
Share on other sites

@pubeoutros On first glance, that code looks fine. The solution for these types of issues (mouseover, focus, etc) is often specific to the individual site. You may need to use _WD_Action to move the mouse pointer (see DemoActions function in wd_demo). If the site uses jQuery, you can often use this to trigger the required events.

My recommendation is to use the browser's web console to figure out the exact steps you need to manually perform the task. Once you've determined that, you should then be able to automate these steps with the Webdriver UDF.

Link to comment
Share on other sites

3 hours ago, Danp2 said:

@pubeoutros On first glance, that code looks fine. The solution for these types of issues (mouseover, focus, etc) is often specific to the individual site. You may need to use _WD_Action to move the mouse pointer (see DemoActions function in wd_demo). If the site uses jQuery, you can often use this to trigger the required events.

My recommendation is to use the browser's web console to figure out the exact steps you need to manually perform the task. Once you've determined that, you should then be able to automate these steps with the Webdriver UDF.

The image attached shows the Event option of a button.

1.png

But with:

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $Item)
$sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}'

$Script = 'document.mouseover()'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

$Script = 'document.mouseenter'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

$Script = 'document.focus()'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

_WD_ElementAction($sSession, $sElement, 'click')

I can't see the button get focus neither the button get mouseover.

I'm trying in the google.com search button.

From:

ConsoleWrite($sResponse & @CRLF)

I got this:

{"value":{"error":"javascript error","message":"javascript error: document.focus is not a function\n ....

 

So the "document" is right? I don't think so.

Edited by pubeoutros
Link to comment
Share on other sites

@pubeoutros FWIW, you are headed down the wrong path with the "document.whatever" stuff. I've already given you my recommendation on how to tackle this situation. If you're unable / unwilling to do that, then I don't know how I provide further assistance unless you provide a URL where we can test this on our end.

Link to comment
Share on other sites

First:

23 hours ago, pubeoutros said:

 

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $Item)
$sJsonElement = '{"' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}'

$Script = 'document.onmouseover'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

$Script = 'document.focus()'
$sResponse = _WD_ExecuteScript($sSession, $Script, $sJsonElement)

_WD_ElementAction($sSession, $sElement, 'click')

I tried this but doesn't work, in my opinion the "document" should be the problem, but i don't know what to put there.

 

23 hours ago, Danp2 said:

@pubeoutros On first glance, that code looks fine. The solution for these types of issues (mouseover, focus, etc) is often specific to the individual site. You may need to use _WD_Action to move the mouse pointer (see DemoActions function in wd_demo). If the site uses jQuery, you can often use this to trigger the required events.

 

 

19 hours ago, Danp2 said:

@pubeoutros FWIW, you are headed down the wrong path with the "document.whatever" stuff. I've already given you my recommendation on how to tackle this situation. If you're unable / unwilling to do that, then I don't know how I provide further assistance unless you provide a URL where we can test this on our end.

Second:

20 hours ago, pubeoutros said:

I can't see the button get focus neither the button get mouseover.

I'm trying in the google.com search button.

From:

ConsoleWrite($sResponse & @CRLF)

I got this:

{"value":{"error":"javascript error","message":"javascript error: document.focus is not a function\n ....

 

So the "document" is right? I don't think so.

 

19 hours ago, Danp2 said:

@pubeoutros FWIW, you are headed down the wrong path with the "document.whatever" stuff. I've already given you my recommendation on how to tackle this situation. If you're unable / unwilling to do that, then I don't know how I provide further assistance unless you provide a URL where we can test this on our end.

 

Thanks anyway!

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 2024/09/21
  • Melba23 pinned this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...