Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

Danp2

This is the "General Help and Support" thread for the WebDriver UDF.

The UDF itself can be downloaded here.

So if you have any questions, suggestions or errors please post here.

  • Thanks 1

Share this post


Link to post
Share on other sites
mLipok

What's with this thread:

 

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
Danp2

@mLipok This thread was created to handle the GH&S type issues. The other thread was getting "cluttered", so my intention is to move the general discussion here and the thread in the Examples section will be updated as any further development occurs.

Make sense? :)

Share this post


Link to post
Share on other sites
Danp2

@NguyenLe, this is a continuation of our discussion from the other thread.

 

If you examine the code for _WD_WaitElement, you will see that it just calls _WD_FindElement in a loop. Can you provide a simple example where _WD_FindElement doesn't find an element that is present on the page? Be sure to utilize a website that is accessible to everyone.

Also, it would be interesting to get your perspective on whether this issue could be related to the character encoding.

Share this post


Link to post
Share on other sites
mrPuh

Hi for all!

Sorry for my English)

My task is use this legendary UDF from Danp2 for Opera browser.

Webdriver for Opera: https://github.com/operasoftware/operachromiumdriver/releases

I get code for Chrome. He work beautiful:
 

Spoiler

 


#include "wd_helper.au3"
#include "wd_core.au3"

Local $sDesiredCapabilities

$_WD_DEBUG = True

_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}'
_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://www.earnstations.com/")
_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
$sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
_WD_ElementAction($sSession, $sElement, 'click')


 

Then I modify for Opera:
 

Spoiler

 


#include "wd_helper.au3"
#include "wd_core.au3"

Local $sDesiredCapabilities

$_WD_DEBUG = True

_WD_Option('Driver', 'operadriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\opera.log')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"operaOptions": {"w3c": true }}}}'
_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://www.earnstations.com/")
_WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
$sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
_WD_ElementAction($sSession, $sElement, 'click')

 

 

 


 

Error is "session not created exception: Missing or invalid capabilities":
 

Spoiler

 


_WDStartup: OS: WIN_10 WIN32_NT 16299 
_WDStartup: AutoIt: 3.3.14.2
_WDStartup: WD.au3: 0.1.0.9
_WDStartup: Driver: operadriver.exe
_WDStartup: Params: --log-path=E:\AutoIT\WebDriver\opera.log
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"operaOptions": {"w3c": true }}}}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"c913c1a4e33cad552b8a4a4fc0b53794","status":33,"value":{"message":"session not created exception: Missing or invalid capabilities\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_CreateSession: {"sessionId":"c913c1a4e33cad552b8a4a4fc0b53794","status":33,"value":{"message":"session not created exception: Missing or invalid capabilities\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_CreateSession ==> Webdriver Exception: session not created exception: Missing or invalid capabilities
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://www.earnstations.com/"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_Navigate: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//a[@class='btn']"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_FindElement: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//a[@class='btn']"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_FindElement: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element/no such session
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)/click; $sData={"id":"no such session
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}
"E:\AutoIT\WebDriver\wd_core.au3" (1197) : ==> Subscript used on non-accessible variable.:
Local $hConnect = _WinHttpConnect($hOpen, $aURL[2], $_WD_PORT)
Local $hConnect = _WinHttpConnect($hOpen, $aURL^ ERROR

 

Opera don't launch.

Help please!

 

Share this post


Link to post
Share on other sites
Danp2

@mrPuh What about the Opera webdriver console? Can you post the output from there?

P.S. Add some error checking to your code. For example --

$sSession = _WD_CreateSession($sDesiredCapabilities)

If @error = $_WD_ERROR_Success Then
    _WD_Navigate($sSession, "https://www.earnstations.com/")
    _WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
    $sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
    _WD_ElementAction($sSession, $sElement, 'click')
EndIf

 

Share this post


Link to post
Share on other sites
mrPuh
55 minutes ago, Danp2 said:

@mrPuh What about the Opera webdriver console? Can you post the output from there?

When I launch Chrome webdriver in console this message.

When I launch Opera webdriver in console this message and Opera don't launch.

When I set $sDesiredCapabilities = '{"capabilities": { } }' in AutoIT console this:

 

Spoiler

 

_WDStartup: OS: WIN_10 WIN32_NT 16299 
_WDStartup: AutoIt: 3.3.14.2
_WDStartup: WD.au3: 0.1.0.9
_WDStartup: Driver: operadriver.exe
_WDStartup: Params: --log-path=E:\AutoIT\WebDriver\opera.log
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": { } }
__WD_Post: StatusCode=200; ResponseText={"sessionId":"ec33cd4275f46e9933b25d862d7cd862","status":33,"value":{"message":"session not created exception: Missing or invalid capabilities\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_CreateSession: {"sessionId":"ec33cd4275f46e9933b25d862d7cd862","status":33,"value":{"message":"session not created exception: Missing or invalid capabilities\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_CreateSession ==> Webdriver Exception: session not created exception: Missing or invalid capabilities
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://www.earnstations.com/"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_Navigate: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//a[@class='btn']"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_FindElement: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//a[@class='btn']"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
_WD_FindElement: {"sessionId":"","status":6,"value":{"message":"no such session\n  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element/no such session
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)/click; $sData={"id":"no such session
  (Driver info: OperaDriver=2.33 (3c26e9df3b0e313077a02a7d6ecab2264700bf10),platform=Windows NT 10.0.16299 x86_64)"}
"E:\AutoIT\WebDriver\wd_core.au3" (1197) : ==> Subscript used on non-accessible variable.:
Local $hConnect = _WinHttpConnect($hOpen, $aURL[2], $_WD_PORT)
Local $hConnect = _WinHttpConnect($hOpen, $aURL^ ERROR

 

 

 

Share this post


Link to post
Share on other sites
mrPuh

This is opera.log:

[0.430][INFO]: COMMAND InitSession {
   "capabilities": {

   }
}
[0.451][INFO]: RESPONSE InitSession session not created exception: Missing or invalid capabilities

Danp2 thanks for you participation to solve my problem.

Share this post


Link to post
Share on other sites
Danp2
15 minutes ago, mrPuh said:

[0.451][INFO]: RESPONSE InitSession session not created exception: Missing or invalid capabilities

It looks like you will need to keep trying different options until you find a working example.

You may want to review the following links f you haven't already done so --

https://github.com/operasoftware/operachromiumdriver/blob/master/docs/desktop.md

https://sites.google.com/a/chromium.org/chromedriver/capabilities#TOC-List-of-recognized-capabilities

Share this post


Link to post
Share on other sites
mrPuh
Posted (edited)

I try many variants to set capabilities, but can't find working example.

Who can help solve this problem?

Edited by mrPuh

Share this post


Link to post
Share on other sites
Jury

I've downloaded all the necessary files to the necessary directories (I think)

I'm trying to get this to work and think I've got part way there (firefox isn't my default browser)

I'm a little confused about using  _WD_ or _WD  as for example in _WD_Navigate or _WDNavigate  this one seems to work _WDNavigate

I see in wd_core.au3  there is a parameter Global $_WD_DRIVER = "" ; Path to web driver executable 

 

#include "wd_helper.au3"
#include "wd_core.au3"
Global $_WD_DRIVER
Local $sDesiredCapabilities
Local $iIndex
$sCommand ="C:\Program Files (x86)\Mozilla Firefox\"
$_WD_DRIVER = $sCommand & "firefox.exe"

SetupGecko()
_WDStartup()
$sSession = _WDCreateSession($sDesiredCapabilities)
_WDNavigate($sSession, 'http://google.com')
$sElement = _WDFindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='gsfi']")

If @error = $_WD_ERROR_Success Then
    _WDElementAction($sSession, $sElement, 'value','Hello')
EndIf

Func SetupGecko()
_WDOption('Driver', 'C:\Users\PC1\Documents\AutoIt_code\geckodriver.exe')
_WDOption('DriverParams', '--log trace')
_WDOption('Port', 4444)

$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc

I'm a little confused about using  _WD_ or _WD  as for example in _WD_Navigate or _WDNavigate  this one seems to work _WDNavigate

The Console gives me:

_WDStartup: OS: WIN_10 WIN32_NT 16299
_WDStartup: AutoIt: 3.3.14.3
_WDStartup: WD.au3: 0.1.0.3
_WDStartup: Driver: C:\Users\PC1\Documents\AutoIt_code\geckodriver.exe
_WDStartup: Params: --log trace
_WDStartup: Port: 4444
__WD_Post: URL=
HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}
__WD_Post ==> Webdriver Exception: {"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}
_WDCreateSession: {"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}}
_WDCreateSession ==> Webdriver Exception: HTTP status = 500
__WD_Post: URL=
HTTP://127.0.0.1:4444/session//url; $sData={"url":"http://google.com"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"unknown command","message":"POST /session//url did not match a known command","stacktrace":""}}
__WD_Post ==> Webdriver Exception: {"value":{"error":"unknown command","message":"POST /session//url did not match a known command","stacktrace":""}}
_WDNavigate: {"value":{"error":"unknown command","message":"POST /session//url did not match a known command","stacktrace":""}}
_WDNavigate ==> Webdriver Exception: HTTP status = 404
__WD_Post: URL=
HTTP://127.0.0.1:4444/session//element; $sData={"using":"xpath","value":"//a[@class='gsfi']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"unknown command","message":"POST /session//element did not match a known command","stacktrace":""}}
__WD_Post ==> Webdriver Exception: {"value":{"error":"unknown command","message":"POST /session//element did not match a known command","stacktrace":""}}
_WDGetElement: {"value":{"error":"unknown command","message":"POST /session//element did not match a known command","stacktrace":""}}
_WDGetElement ==> No match: unknown command

 

Share this post


Link to post
Share on other sites
Danp2
5 minutes ago, Jury said:

I'm a little confused about using  _WD_ or _WD  as for example in _WD_Navigate or _WDNavigate  this one seems to work _WDNavigate

The Console gives me:

_WDStartup: OS: WIN_10 WIN32_NT 16299
_WDStartup: AutoIt: 3.3.14.3
_WDStartup: WD.au3: 0.1.0.3

The latest version is 0.1.0.9. Please update to that and then try again.

https://github.com/Danp2/WebDriver/releases/latest

Share this post


Link to post
Share on other sites
Danp2

@Jury There was an updated version of geckodriver released earlier this week, so you should make sure that you have the latest version of it as well.

Also, if Firefox isn't installed in the default location, you'll need to provide the location of the executable. You can read more info about moz:firefoxOptions here.

Share this post


Link to post
Share on other sites
Jury

Thanks I'd hoped this would do the trick (but didn't):

 

Func SetupGecko()
$ff = '--binary C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
_WDOption('Driver', 'geckodriver')
_WDOption('DriverParams', $ff)
_WDOption('Port', 2828)

$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc

 

Share this post


Link to post
Share on other sites
Danp2
Posted (edited)

The DriverParams is used to pass parameters to the web driver. It's not for indicating the location of the browser executable. This would be done as part of DesiredCapabilities, which gets passed to _WD_CreateSession.

Edit: @Jury I just reread the flags section and see where they say this should work as you indicated. Can you post the contents from the Scite output window?

Edited by Danp2

Share this post


Link to post
Share on other sites
Danp2
3 hours ago, Jury said:

C:\Program Files (x86)\Mozilla Firefox\firefox.exe

So is this the 32-bit version of Firefox?  Not sure that it matters, but are you running the Win32 or Win64 version of the Geckodriver?

Share this post


Link to post
Share on other sites
CYCho

Thanks a lot, @Danp2. Your UDF works great. Now I have 2 questions. First, what is the syntax of $sDesiredCapbilities? For example, how do I integrate 'start-maximized' option in the $sDesiredCapabilities? The 2nd question is, what happens if I don't call _WD_DeleteSession() function at the end of my code? Will it create any prolem if I do it repeatedly, such as temporary files piling up in the computer? Currently I'm not calling this function because I want to keep the website open after the code is finished. I just call _WD_Shutdown(). Your answers will be greatly appreciated.

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • Danp2
      By Danp2
      Introduction
      This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
      Requirements
      JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
      WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/
      WebDriver for desired browser
      Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Function List
      Core Functions
      _WD_CreateSession($sDesiredCapabilities='{}') _WD_DeleteSession($sSession) _WD_Status() _WD_Timeouts($sSession, $sTimeouts = '') _WD_Navigate($sSession, $sURL) _WD_Action($sSession, $sCommand) _WD_Window($sSession, $sCommand, $sOption = '') _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement = "", $lMultiple = False) _WD_ElementAction($sSession, $sElement, $sCommand, $sOption='') _WD_ExecuteScript($sSession, $sScript, $sArguments="[]") _WD_Alert($sSession, $sCommand, $sOption = '') _WD_GetSource($sSession) _WD_Cookies($sSession, $sCommand, $sOption = '') _WD_Option($sOption, $vValue = "") _WD_Startup() _WD_Shutdown() Helper Functions
      _WD_NewTab($sSession, $lSwitch = True) _WD_Attach($sSession, $sString, $sMode = 'title') _WD_LinkClickByText($sSession, $sText, $lPartial = True) _WD_WaitElement($sSession, $sElement, $sStrategy, $sSelector[, $iDelay = 0[, $iTimeout = -1]]) _WD_LastHTTPResult() _WD_GetFrameCount() _WD_IsWindowTop() _WD_FrameEnter($sIndexOrID) _WD_FrameLeave() _WD_HighlightElement($sSession, $sElement[, $iMethod = 1]) _WD_HighlightElements($sSession, $aElements[, $iMethod = 1]) WD_LoadWait($sSession, $iDelay = 0, $iTimeout = -1, $sElement = '') Source Code
      You will always be able to find the latest version in the GitHub Repo 
      Help / Support
      Please post any questions, suggestions or errors in the GH&S thread.
      https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/
    • Davidowicza
      By Davidowicza
      Hey guys,
      I am creating my very first script that automates a browser (I usually work with program installs and database automation) and have come across an issue that I am totally stumped on. I need to click an element that gives me a drop down list box but the Xpath to the element changes with every instance of chrome I start...
      I have tried selecting the class, rect, and path but no luck. It never finds the element. (I could be doing this wrong since I am not good at HTML)
      Element I need to select:
      This is the Xpath for the last 3 instances of chrome I have run the script with:
      //*[@id="highcharts-5bp9crq-8"]/svg/g[6]/g/rect //*[@id="highcharts-fiw9szv-8"]/svg/g[6]/g/rect //*[@id="highcharts-5szkmx8-8"]/svg/g[6]/g/rect As you can see the path changes every time.
      How I am trying to select the element:
      ;Check for box element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") MsgBox(0, "", "check for timeout") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") _WD_ElementAction($sSession, $sElement, 'click') Maybe someone has come across this before and found a work around without using mouseclick()
      Thanks guys, hopefully I am just very overlooking something simple and can be pointed to the right solution.
      Side Note: I wish I could share the webpage entirety, but it has sensitive information with my agency that I cannot share. If you need more, just let me know and I will try and post as much as I can.
    • daluu
      By daluu
      This is kind of already posted here:
      '?do=embed' frameborder='0' data-embedContent>>
      but wanted to note this in this forum of example scripts in case some people only look in this forum for examples and not the other forums with respect to AutoIt integration or relation to Selenium WebDriver.
      So, the example in summary is: you can use Selenium WebDriver API to do AutoIt GUI automation (the ControlXyz() and WinXyz() functons, along with mouse and "send keys" functions). Although I suppose that might be opposite or counter to what most examples here are about - using AutoIt to do or control other stuff rather than using other stuff to control/run AutoIt. But regardless, it is an example implementation of a different use case for AutoIt beyond the general AutoIt community, like those who also use Selenium WebDriver and/or need to integrate Selenium with AutoIt for remote deployment.
      https://github.com/daluu/AutoItDriverServer
      with specific demo examples here:
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/CalculatorTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/calculator.py
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationWithAutoItDriver.py
×