Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

What's with this thread:

 

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication 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 * SciTE - Lexer for console pane

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: 2019-10-01

Share this post


Link to post
Share on other sites

@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

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

@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
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

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

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

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

@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

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

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

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
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • 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 Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ 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, $iTimeout = -1, $sURL = "", $sFeatures = "") _WD_Attach($sSession, $sString, $sMode = 'title') _WD_LinkClickByText($sSession, $sText, $lPartial = True) _WD_WaitElement($sSession, $sElement, $sStrategy, $sSelector[, $iDelay = 0[, $iTimeout = -1]]) _WD_GetMouseElement($sSession) _WD_GetElementFromPoint($sSession, $iX, $iY) _WD_LastHTTPResult() _WD_GetFrameCount() _WD_IsWindowTop() _WD_FrameEnter($sIndexOrID) _WD_FrameLeave() _WD_HighlightElements($sSession, $aElements[, $iMethod = 1]) _WD_jQuerify($sSession[, $sjQueryFile = Default[, $iTimeout = Default]]) _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_ElementSelectAction($sSession, $sSelectElement, $sCommand) _WD_ConsoleVisible($lVisible = False) _WD_LoadWait($sSession[, $iDelay = 0[, $iTimeout = -1[, $sElement = '']]]) _WD_Screenshot($sSession, $sElement = '', $nOutputType = 1) _WD_SelectFiles($sSession, $sStrategy, $sSelector, $sFilename) _WD_GetShadowRoot($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_IsLatestRelease() _WD_UpdateDriver($sBrowser[, $sInstallDir = Default[, $lFlag64 = Default[, $lForce = Default]]]) _WD_DownloadFile($sURL, $sDest) 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/201106-webdriver-udf-help-support-ii/
       
    • By JohnWIlling
      We are running on a VIrtual Machine via Remote Desktop.  We are having a situation where the loading of the chromedriver.exe is taking longer on the VM than on a physical machine.  It is causing the first call to  WD_Post in _WD_CreateSession to fail.
      To workaround the Issue, I used a simplified version of (_WinAPI_GetTcpTable) UDF to Loop waiting for the driver port to be in the listening state.  At that point, I know that the Post will work:
      Func _WaitForPort($ListenPort) Do Local $tMIB_TCPTABLE = DllStructCreate("dword[6]") Local $aRet = DllCall("Iphlpapi.dll", "DWORD", "GetTcpTable", "struct*", $tMIB_TCPTABLE, "DWORD*", 0, "BOOL", True) Local $dwSize = $aRet[2] $tMIB_TCPTABLE = DllStructCreate("DWORD[" & $dwSize / 4 & "]") $aRet = DllCall("Iphlpapi.dll", "DWORD", "GetTcpTable", "struct*", $tMIB_TCPTABLE, "DWORD*", $dwSize, "BOOL", True) If $aRet[0] <> 0 Then Return SetError(1) Local $iNumEntries = DllStructGetData($tMIB_TCPTABLE, 1, 1) Local $aRes[$iNumEntries][6] For $i = 0 To $iNumEntries - 1 Local $Type = DllStructGetData($tMIB_TCPTABLE, 1, 2 + $i * 5 + 0) $aRet = DllCall("ws2_32.dll", "ushort", "ntohs", "uint", DllStructGetData($tMIB_TCPTABLE, 1, 2 + $i * 5 + 2)) ; local port Local $Port = $aRet[0] ConsoleWrite("Checking Row:" & $i & " State:<" & $Type & "> Port:<" & $Port & ">" & @CRLF) ; Type 2 is LISTENING If $Type = 2 And $Port = $ListenPort Then Return 1; EndIF Next Sleep(500); Until 0; Return 0; EndFunc ;==>_WaitForPort  
    • By svenjatzu
      hey hi
      someone please can help me translate my code to be valid for udf webriver?
       
      #RequireAdmin Opt("WinTitleMatchMode",2) ;~ Sleep(10000) ShellExecute("C:\neu\1.lnk") ;~ Sleep(3000) ;~ $PID = ShellExecute("C:\freeneu\tab.exe") ;~ Sleep(30000*5) WinWait("Example Domain - Iron","") Global $sWinTitle = "Example Domain - Iron" Global $avWinList = WinList($sWinTitle) While $avWinList[0][0] < 1 Sleep(250); Wait for new process to create its GUI $avWinList = WinList($sWinTitle) WEnd For $n = 1 To $avWinList[0][0] WinActivate($avWinList[$n][1]) WinMove($avWinList[$n][1], "", 0, 0, 230, 440) Next Opt("WinTitleMatchMode",1) WinWait("Iron") Sleep(5333) WinWait("Iron") Opt("WinTitleMatchMode",2) WinWaitActive("m:") WinWait("m:") WinClose("m:") ;~ Sleep(5000) Sleep(1000) ;~ ProcessClose("tab.exe") ShellExecute(@ScriptDir & "\q2.exe")  
    • By water
      Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF.
      Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver.
      That's why I have started to create a tutorial in the wiki.
      It should describe all necessary steps from intallation to usage.

      I'm still collecting ideas for the tutorial - that's where you come into play.
      What do you expect to see in such a tutorial?
      Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments
       
      ToDo-List:
      Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab).
    • By water
      The WebDriver UDF provides a toolbox full of functions to facilitate automating Web browsers.
      Still scripts can become quite complex.
      In this thread users can post "real life" examples to show how specific tasks can be implemented.
      Note
      When posting an example please describe the purpose of the script and the WebDriver functionality used!
       
×
×
  • Create New...