Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

29 minutes ago, Danp2 said:

This is no longer the correct syntax. It's now "goog:chromeOptions". Check out wd_demo script for the correct usage.

Thanks, all is good now.

Share this post


Link to post
Share on other sites

Hi Dan !

I downloaded  the latest version of the webriver and i found this function : 

; #FUNCTION# ====================================================================================================================
; Name ..........: _WD_ElementOptionSelect
; Description ...: Find and click on an option from a Select element
; Syntax ........: _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector[, $sStartElement = ""])
; Parameters ....: $sSession            - Session ID from _WDCreateSession
;                  $sStrategy           - Locator strategy. See defined constant $_WD_LOCATOR_* for allowed values
;                  $sSelector           - Value to find
;                  $sStartElement       - [optional] Element ID of element to use as starting point
; Return values .: None
;                  @ERROR       - $_WD_ERROR_Success
;                                  - $_WD_ERROR_NoMatch
;                  @EXTENDED    - WinHTTP status code
; Author ........: Dan Pollak
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: No
; ===============================================================================================================================
Func _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "")


    Local $sElement = _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement)

    If @error = $_WD_ERROR_Success Then
        _WD_ElementAction($sSession, $sElement, 'click')
    EndIf
EndFunc


In this website : https://www.nvidia.fr/Download/index.aspx?lang=fr

We ve got a lot of select box  and all i want is to select a specifical value  on the selectbox
I but i still can t understand how i can select a value using this function

Can you give us an example using the demo script and the url I gave ?

Thanks for all

Share this post


Link to post
Share on other sites

I would like to edit a classname, so I can remove the word "hidden" and then search the text. By default I have to hover mouse to get the text to show up.

Share this post


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

@Arlen What have you tried? Help us help you by giving more details. ☺️

Well basically if I'm able to run a jQuery, I can unhide an element. Is it possible with WD?

Share this post


Link to post
Share on other sites

Hi Dan ! 

Hi tried your exemple and it does not works 

Here is the stack trace : 

_WDStartup: OS:    WIN_7 WIN32_NT 7601 Service Pack 1
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.18
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="D:\Users\u05e265\Desktop\AUTOIT WebDriver\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5)","userDataDir":"D:\\Users\\u05e265\\AppData\\Local\\Temp\\scoped_dir5632_20627"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:63634"},"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"72.0.3626.121","webStorageEnabled":true},"sessionId":"5766ba7923d0d61aabe32d4a5509499f"}}
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5)","userDataDir":"D:\\Users\\u05e265\\AppData\\Local\\Temp\\scoped_dir5632_20627"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:63634"},"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"72.0.3626.121","webStorageEnabled":true},"sessionId":"5766ba7923d0d61aabe32d4a5509499f"}}
Bypass: DemoTimeouts
Running: DemoNavigation
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5766ba7923d0d61aabe32d4a5509499f/window/maximize; $sData=
__WD_Post: StatusCode=200; ResponseText={"value":{"height":1026,"width":1696,"x":-8,"y":-8}}
_WD_Window: {"value":{"height":1026,"width":1696,"x":-8,"y":-8}}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5766ba7923d0d61aabe32d4a5509499f/url; $sData={"url":"https://www.nvidia.fr/Download/index.aspx?lang=fr"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5766ba7923d0d61aabe32d4a5509499f/element; $sData={"using":"xpath","value":"//select[@id='selProductSeriesType']/option[5]?"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid selector","message":"Unable to locate an element with the xpath expression //select[@id='selProductSeriesType']/option[5]? because of the following errorSyntaxErrorFailed to execute 'evaluate' on 'Document'The string '//select[@id='selProductSeriesType']/option[5]?' is not a valid XPath expression.(Session infochrome=72.0.3626.121)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0136AA90+830096]\n\tOrdinal0 [0x0131581D+481309]\n\tOrdinal0 [0x012EAC47+306247]\n\tOrdinal0 [0x012EC81C+313372]\n\tOrdinal0 [0x012EC706+313094]\n\tOrdinal0 [0x012B8431+99377]\n\tOrdinal0 [0x012D3440+209984]\n\tOrdinal0 [0x012CAAD0+174800]\n\tOrdinal0 [0x012D208B+204939]\n\tOrdinal0 [0x012CA93B+174395]\n\tOrdinal0 [0x012B2D54+77140]\n\tOrdinal0 [0x012B430C+82700]\n\tOrdinal0 [0x012B4260+82528]\n\tOrdinal0 [0x01375302+873218]\n\tOrdinal0 [0x01320553+525651]\n\tOrdinal0 [0x01320783+526211]\n\tOrdinal0 [0x0132086C+526444]\n\tOrdinal0 [0x013783A7+885671]\n\tOrdinal0 [0x013203BF+525247]\n\tOrdinal0 [0x0132A60E+566798]\n\tOrdinal0 [0x01335DDB+613851]\n\tOrdinal0 [0x01335F45+614213]\n\tOrdinal0 [0x01335175+610677]\n\tBaseThreadInitThunk [0x75FA344D+18]\n\tRtlInitializeExceptionChain [0x775E9802+99]\n\tRtlInitializeExceptionChain [0x775E97D5+54]\n"}}
_WD_FindElement: {"value":{"error":"invalid selector","message":"Unable to locate an element with the xpath expression //select[@id='selProductSeriesType']/option[5]? because of the following errorSyntaxErrorFailed to execute 'evaluate' on 'Document'The string '//select[@id='selProductSeriesType']/option[5]?' is not a valid XPath expression.(Session infochrome=72.0.3626.121)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0136AA90+830096]\n\tOrdinal0 [0x0131581D+481309]\n\tOrdinal0 [0x012EAC47+306247]\n\tOrdinal0 [0x012EC81C+313372]\n\tOrdinal0 [0x012EC706+313094]\n\tOrdinal0 [0x012B8431+99377]\n\tOrdinal0 [0x012D3440+209984]\n\tOrdinal0 [0x012CAAD0+174800]\n\tOrdinal0 [0x012D208B+204939]\n\tOrdinal0 [0x012CA93B+174395]\n\tOrdinal0 [0x012B2D54+77140]\n\tOrdinal0 [0x012B430C+82700]\n\tOrdinal0 [0x012B4260+82528]\n\tOrdinal0 [0x01375302+873218]\n\tOrdinal0 [0x01320553+525651]\n\tOrdinal0 [0x01320783+526211]\n\tOrdinal0 [0x0132086C+526444]\n\tOrdinal0 [0x013783A7+885671]\n\tOrdinal0 [0x013203BF+525247]\n\tOrdinal0 [0x0132A60E+566798]\n\tOrdinal0 [0x01335DDB+613851]\n\tOrdinal0 [0x01335F45+614213]\n\tOrdinal0 [0x01335175+610677]\n\tBaseThreadInitThunk [0x75FA344D+18]\n\tRtlInitializeExceptionChain [0x775E9802+99]\n\tRtlInitializeExceptionChain [0x775E97D5+54]\n"}}
_WD_FindElement ==> Webdriver Exception: HTTP status = 400
Bypass: DemoElements
Bypass: DemoScript
Bypass: DemoCookies
Bypass: DemoAlerts
Bypass: DemoFrames
Bypass: DemoActions
Bypass: DemoWindows

To try you can place this code on the wd_demo.au3 

Func DemoNavigation()
;~     _WD_Navigate($sSession, "http://google.com")
;~     _WD_NewTab($sSession)
;~     _WD_Navigate($sSession, "http://yahoo.com")
;~     _WD_NewTab($sSession, True, -1, 'http://bing.com', 'width=200,height=200')

;~     ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
;~     _WD_Attach($sSession, "google.com", "URL")
;~     ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)
;~     _WD_Attach($sSession, "yahoo.com", "URL")
;~     ConsoleWrite("URL=" & _WD_Action($sSession, 'url') & @CRLF)

    _WD_Window($sSession, "maximize")
    _WD_Navigate($sSession, "https://www.nvidia.fr/Download/index.aspx?lang=fr")
    _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//select[@id='selProductSeriesType']/option[5]")

EndFunc

Thanks for your help

Share this post


Link to post
Share on other sites
1 hour ago, Danp2 said:

Yes, just run the same Javascipt command using _WD_ExecuteScript.

_WD_ExecuteScript($sSession, "$(#CurrencyCalc).removeClass('hidden');")
Quote

__WD_Post: URL=HTTP://127.0.0.1:9515/session/de34cbaef11af78e403d4cc64e5b4349/execute/sync; $sData={"script":"$(#CurrencyCalc).removeClass('hidden');", "args":[[]]}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"Runtime.evaluate threw exception: SyntaxError: Unexpected identifier\n  (Session info: chrome=74.0.3729.131)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E6DB63+1432419]\n\tOrdinal0 [0x00DE8D81+888193]\n\tOrdinal0 [0x00D8B9D1+506321]\n\tOrdinal0 [0x00D90907+526599]\n\tOrdinal0 [0x00D8D34D+512845]\n\tOrdinal0 [0x00D8D184+512388]\n\tOrdinal0 [0x00D8D562+513378]\n\tOrdinal0 [0x00D47366+226150]\n\tOrdinal0 [0x00D3EA0D+190989]\n\tOrdinal0 [0x00D46D94+224660]\n\tOrdinal0 [0x00D3E8AB+190635]\n\tOrdinal0 [0x00D25F16+89878]\n\tOrdinal0 [0x00D2757A+95610]\n\tOrdinal0 [0x00D27474+95348]\n\tGetHandleVerifier [0x00FCDE7C+1274156]\n\tGetHandleVerifier [0x00F1B6D9+543113]\n\tGetHandleVerifier [0x00F1B4E0+542608]\n\tOrdinal0 [0x00E7B508+1488136]\n\tGetHandleVerifier [0x00F1BC86+544566]\n\tOrdinal0 [0x00DFEEC5+978629]\n\tOrdinal0 [0x00E0B35B+1028955]\n\tOrdinal0 [0x00E0B49F+1029279]\n\tOrdinal0 [0x00E0A445+1025093]\n\tBaseThreadInitThunk [0x76970179+25]\n\tRtlGetAppContainerNamedObjectPath [0x771A662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x771A65FD+189]\n"}}
_WD_ExecuteScript: {"value":{"error":"unknown error","message":"Runtime.evaluate threw exception: SyntaxError: Unexpected identifier\n  (Session info: chrome=74.0.3729.131)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00E6DB63+1432419]\n\tOrdinal0 [0x00DE8D81+888193]\n\tOrdinal0 [0x00D8B9D1+506321]\n\tOrdinal0 [0x00D90907+526599]\n\tOrdinal0 [0x00D8D34D+512845]\n\tOrdinal0 [0x00D8D184+512388]\n\tOrdinal0 [0x00D8D562+513378]\n\tOrdinal0 [0x00D47366+226150]\n\tOrdinal0 [0x00D3EA0D+190989]\n\tOrdinal0 [0x00D46D94+224660]\n\tOrdinal0 [0x00D3E8AB+190635]\n\tOrdinal0 [0x00D25F16+89878]\n\tOrdinal0 [0x00D2757A+95610]\n\tOrdinal0 [0x00D27474+95348]\n\tGetHandleVerifier [0x00FCDE7C+1274156]\n\tGetHandleVerifier [0x00F1B6D9+543113]\n\tGetHandleVerifier [0x00F1B4E0+542608]\n\tOrdinal0 [0x00E7B508+1488136]\n\tGetHandleVerifier [0x00F1BC86+544566]\n\tOrdinal0 [0x00DFEEC5+978629]\n\tOrdinal0 [0x00E0B35B+1028955]\n\tOrdinal0 [0x00E0B49F+1029279]\n\tOrdinal0 [0x00E0A445+1025093]\n\tBaseThreadInitThunk [0x76970179+25]\n\tRtlGetAppContainerNamedObjectPath [0x771A662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x771A65FD+189]\n"}}

What am I doing wrong?

Share this post


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

Have you tried putting quotes around the selector (#CurrencyCalc)?

Thanks it works.

Share this post


Link to post
Share on other sites

Hello, Danp2!

Why element don't found after send PageDown to browser?

Example 1 - element founded:

$sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
_WD_ElementAction($sSession, $sElement, 'click')

Example 2 - element not founded:

Send('{PGDN}')
Sleep(1000)
Send('{PGDN}')
Sleep(1000)
$sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//a[@class='btn']")
_WD_ElementAction($sSession, $sElement, 'click')

Why Example 2 don't work?

Share this post


Link to post
Share on other sites

Hi at all,

how can I figure out that witch options are belongs to witch select-group (id: pices or id: size)?

For example to order (click) 3 t-shirt's  in size 7 at a web-shop.

 

<select size='1' name='pices' id='pices'>
  <option value='0'>0</option>
  <option value='1' selected>1</option>
  <option value='2'>2</option>
  <option value='3'>3</option>
  <option value='4'>4</option>
  <option value='5'>5</option>
  <option value='6'>6</option>
  <option value='7'>7</option>
  <option value='8'>8</option>
  <option value='9'>9</option>
  <option value='0'>0</option>
</select>

<select size='1' name='size' id='size'>
  <option value='0'>0</option>
  <option value='1' selected>1</option>
  <option value='2'>2</option>
  <option value='3'>3</option>
  <option value='4'>4</option>
  <option value='5'>5</option>
  <option value='6'>6</option>
  <option value='7'>7</option>
  <option value='8'>8</option>
  <option value='9'>9</option>
  <option value='0'>0</option>
</select>

with the command:

$aOptions = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//option", '', True)

I will get all options of both select-groups an each will be double.

 

 

Share this post


Link to post
Share on other sites
1 hour ago, Danp2 said:

@Hamburgo Have you tried something like this?

$aOptions = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='size']/option", '', True)

 

@Danp2 Perfect !!!

;))

With the command:    $sText = _WD_ElementAction($sSession, $aOptions[$i], 'text')   I get the text of each option. That is fine.

With the command:    $sValue = _WD_ElementAction($sSession, $aOptions[$i], 'value')   I do NOT get the value of each option. That is bad.

The result is allways: {"value":null}

How do I get the value of each option ?

 

Share this post


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

@Hamburgo You likely need to use either 'attribute' or  'property' instead of 'value'.

@Danp2 I am tried both out of success. ;((

on "https://kmu-office.spdns.de/TDL/test/" I have a test-page:

 

<select size='1' name='pices' id='pices'>
  <option value='pv0'>pt0</option>
  <option value='pv1' selected>pt1</option>
  <option value='pv2'>pt2</option>
  <option value='pv3'>pt3</option>
  <option value='pv4'>pt4</option>
  <option value='pv5'>pt5</option>
  <option value='pv6'>pt6</option>
  <option value='pv7'>pt7</option>
  <option value='pv8'>pt8</option>
  <option value='pv9'>pt9</option>
</select>
<BR><BR>
<select size='1' name='size' id='size'>
  <option value='sv0'>st0</option>
  <option value='sv1' selected>st1</option>
  <option value='sv2'>st2</option>
  <option value='sv3'>st3</option>
  <option value='sv4'>st4</option>
  <option value='sv5'>st5</option>
  <option value='sv6'>st6</option>
  <option value='sv7'>st7</option>
  <option value='sv8'>st8</option>
  <option value='sv9'>st9</option>
</select>

The text of each option I get, like pt0 to pt9 OR st0 to st9,

but not pv0 to pv9 OR sv0 to sv9.

$aOptions = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//option[contains(@value,'sv')]", '', True)

This command found out of problems all options with value="sv" 0 to 9

Do you have any other proposal ?

Share this post


Link to post
Share on other sites

Not sure what you are doing wrong (because you didn't post your code 🙄), but the following works for me --

_WD_Navigate($sSession, "https://kmu-office.spdns.de/TDL/test/")
    $aOptions = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//select[@name='size']/option", '', True)
    $sValue = _WD_ElementAction($sSession, $aOptions[3], 'attribute', 'value')
    ConsoleWrite($sValue & @crlf)

 

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