Jump to content
Danp2

WebDriver UDF (W3C compliant version) - 08/04/2020

Recommended Posts

Hace 2 horas, yeison1412 dijo:

ERROR.PNG.0e93a6ad25dea495363636271279a01a.PNG

Saludos a todos, tengo un problema al ejecutar un bot compilado de autoit, que se realizó en otra PC donde funcionó bien, moví el bot a otra PC y recibo una serie de errores relacionados con WD_CORE, ¿cómo debo proceder?

 

Este es un código que encontré en Internet para iniciar el control de Chrome, pero me envía un conjunto de errores. Falta algo en el incluye? y también tengo el controlador de Chrome de acuerdo con la versión de mi Chrome

code.PNG

Share this post


Link to post
Share on other sites

@yeison1412

  1. This is an English speaking forum. So please either write in English, use Google translate or post on the Spanish forum (I assume there is one somewhere 😀)
  2. See here for the proper way to post code on the forum.
  3. Please post the complete results from the Scite output panel (don't take a screen grab; copy and paste the texting using #2 above)

Share this post


Link to post
Share on other sites

This is a code that I found on the internet to start chrome control but it sends me a set of errors. Something is missing in the includes and I also have the chrome driver according to the version of my chrome.

But doesnt work, only show the next errors

i appreciate your answers

#include "wd_core.au3"
#include "wd_helper.au3"
Local $sDesiredCapabilities, $sSession
SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://es-la.facebook.com")
_ChromeSetInputValueById($sSession,'email','abc')
_ChromeSetInputValueById($sSession,'pass','xyz')
_WD_Shutdown()

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, "args":[' & """start-maximized""," & " ""disable-infobars""" & "" & '] }}}}'
EndFunc   ;==>SetupChrome
Func _ChromeSetInputValueById($sSession,$Id,$Value)
 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
 _WD_ElementAction($sSession,$sButton,'value', $Value)
EndFunc



>Running AU3Check (3.3.14.5)  from:C:\Users\user pc\Desktop\AutoIt4  input:E:\programas\Multimedia\documentos\autoit\pizarra chrome.au3
+>07:23:51 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Users\user pc\Desktop\AutoIt4\autoit3.exe "E:\programas\Multimedia\documentos\autoit\pizarra chrome.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_81 WIN32_NT 9600 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.3.0.1 (Up to date)
_WDStartup: WinHTTP:    1.6.4.1
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --log-path="E:\programas\Multimedia\documentos\autoit\chrome.log"
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: unrecognized capability: chromeOpt...
_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: unrecognized capability: chromeOptions","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00359+525145]\n\tOrdinal0 [0x0098623C+25148]\n\tOrdinal0 [0x009ABE2A+179754]\n\tOrdinal0 [0x009ABBC7+179143]\n\tOrdinal0 [0x009ACAD0+182992]\n\tOrdinal0 [0x009ACA3D+182845]\n\tOrdinal0 [0x009AA94B+174411]\n\tOrdinal0 [0x00992528+75048]\n\tOrdinal0 [0x009935A0+79264]\n\tOrdinal0 [0x00993539+79161]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00B2EB7B+1764219]\n\tOrdinal0 [0x00B2ECE3+1764579]\n\tOrdinal0 [0x00B44C05+1854469]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
_WD_CreateSession ==> Webdriver Exception: invalid argument: unrecognized capability: chromeOptions
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://es-la.facebook.com"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_Navigate: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00202+524802]\n\tOrdinal0 [0x00992099+73881]\n\tOrdinal0 [0x009AAA17+174615]\n\tOrdinal0 [0x009A949A+169114]\n\tOrdinal0 [0x009A9074+168052]\n\tOrdinal0 [0x0098235E+9054]\n\tOrdinal0 [0x009827C6+10182]\n\tOrdinal0 [0x00982E50+11856]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00982213+8723]\n\tOrdinal0 [0x00981F20+7968]\n\tGetHandleVerifier [0x00F0DC8C+2981228]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
_WD_Navigate ==> Invalid session ID: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//input[@id='email']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_FindElement: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00202+524802]\n\tOrdinal0 [0x00992099+73881]\n\tOrdinal0 [0x009AAA17+174615]\n\tOrdinal0 [0x009A949A+169114]\n\tOrdinal0 [0x009A9074+168052]\n\tOrdinal0 [0x0098235E+9054]\n\tOrdinal0 [0x009827C6+10182]\n\tOrdinal0 [0x00982E50+11856]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00982213+8723]\n\tOrdinal0 [0x00981F20+7968]\n\tGetHandleVerifier [0x00F0DC8C+2981228]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
_WD_FindElement ==> Invalid session ID: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element//value; $sData={"id":"", "text":"abc"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00202+524802]\n\tOrdinal0 [0x00992099+73881]\n\tOrdinal0 [0x009AAA17+174615]\n\tOrdinal0 [0x009A949A+169114]\n\tOrdinal0 [0x009A9074+168052]\n\tOrdinal0 [0x0098235E+9054]\n\tOrdinal0 [0x009827C6+10182]\n\tOrdinal0 [0x00982E50+11856]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00982213+8723]\n\tOrdinal0 [0x00981F20+7968]\n\tGetHandleVerifier [0x00F0DC8C+2981228]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//input[@id='pass']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_FindElement: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00202+524802]\n\tOrdinal0 [0x00992099+73881]\n\tOrdinal0 [0x009AAA17+174615]\n\tOrdinal0 [0x009A949A+169114]\n\tOrdinal0 [0x009A9074+168052]\n\tOrdinal0 [0x0098235E+9054]\n\tOrdinal0 [0x009827C6+10182]\n\tOrdinal0 [0x00982E50+11856]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00982213+8723]\n\tOrdinal0 [0x00981F20+7968]\n\tGetHandleVerifier [0x00F0DC8C+2981228]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
_WD_FindElement ==> Invalid session ID: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element//value; $sData={"id":"", "text":"xyz"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_ElementAction ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C19563+2725219]\n\tOrdinal0 [0x00B18551+1672529]\n\tOrdinal0 [0x00A00202+524802]\n\tOrdinal0 [0x00992099+73881]\n\tOrdinal0 [0x009AAA17+174615]\n\tOrdinal0 [0x009A949A+169114]\n\tOrdinal0 [0x009A9074+168052]\n\tOrdinal0 [0x0098235E+9054]\n\tOrdinal0 [0x009827C6+10182]\n\tOrdinal0 [0x00982E50+11856]\n\tOrdinal0 [0x00B2D607+1758727]\n\tGetHandleVerifier [0x00D36546+1050150]\n\tGetHandleVerifier [0x00D36291+1049457]\n\tGetHandleVerifier [0x00D410D7+1094071]\n\tGetHandleVerifier [0x00D36B46+1051686]\n\tOrdinal0 [0x00B25B06+1727238]\n\tOrdinal0 [0x00982213+8723]\n\tOrdinal0 [0x00981F20+7968]\n\tGetHandleVerifier [0x00F0DC8C+2981228]\n\tBaseThreadInitThunk [0x74E47C04+36]\n\tRtlInitializeExceptionChain [0x7725B90F+143]\n\tRtlInitializeExceptionChain [0x7725B8DA+90]\n"}}
+>07:23:54 AutoIt3.exe ended.rc:0
+>07:23:54 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 6.106

 

Share this post


Link to post
Share on other sites
20 minutes ago, yeison1412 said:

_WD_CreateSession ==> Webdriver Exception: invalid argument: unrecognized capability: chromeOptions

Please get accustomed to reviewing this output log for error messages. In this case, it's telling you that "chromeOptions" isn't recognized. This is because they changed it to "goog:ChromeOptions". Try it with this line in place of your other one  --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["start-maximized","disable-infobars"]}}}}'

 

Share this post


Link to post
Share on other sites
Posted (edited)

@Danp2, I've been using this code to check if there are updates to any component of your WebDriver UDF including the UDF itself. I thought this code could help someone who just starts using WebDriver to get all the components without a hassle.. This code does not use any WebDriver UDF functions because it was assumed that the user may not have the WebDriver UDF installed. As you will see, I could not figure out how to determine if there was an update to Json.au3. My code just downloads it if it does not exist in the script driectory. This code assumes the use of chromedriver. Other browser users will have to change the code a liitle bit to update their own webdrivers. I know my code is very much amateurish. If you see any usage of this code, I would hope you could throw in some expert's touches.

; WebDriverUpdater.au3
#include <Inet.au3>
#include <String.au3>

If Ping("www.google.com") = 0 Then
    Exit
EndIf

Local $sDriverPath, $hFile, $sMsg, $sChromePath, $sChromeVersion, $sChromeVersionShort, $iPID, $sOutput, $aResult
Local $sCurrentVersion, $sLatestVersion, $iSize, $sZipFile, $oShell, $FilesInZip, $hTime, $sGithub, $sUDF, $aLink, $sLink

$sDriverPath = @ScriptDir & "\"
$hFile = FileOpen($sDriverPath & "\WebDriverUpdater.log", 1+128)
$sMsg = "Update details:"

$sChromePath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "")
If @error Then Exit MsgBox(0, "WebDriver Updater", "Please try after installation of Chrome browser!")

; Install/Update ChromeDriver.exe
$sChromeVersion = FileGetVersion($sChromePath)
$sChromeVersionShort = StringLeft($sChromeVersion, StringInStr($sChromeVersion, ".", 0, -1) -1)
$sMsg &= @CRLF & "Chrome Version" & Chr(9) & Chr(9) & $sChromeVersion

If FileExists($sDriverPath & "chromedriver.exe") Then
    $iPID = Run($sDriverPath & "chromedriver.exe --version", @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
    ProcessWaitClose($iPID)
    $sOutput = StdoutRead($iPID)
    $aResult = _StringBetween($sOutput, "ChromeDriver ", " (")
    $sCurrentVersion = $aResult[0]
Else
    $sCurrentVersion = "None"
EndIf

$sLatestVersion = BinaryToString(InetRead("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_" & $sChromeVersionShort), 4)

$iSize = 0
If $sCurrentVersion <> $sLatestVersion Then
    $sZipFile = $sDriverPath & "chromedriver_win32.zip"
    $iSize = InetGet("https://chromedriver.storage.googleapis.com/" & $sLatestVersion & "/chromedriver_win32.zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT)
    ;https://chromedriver.storage.googleapis.com/78.0.3904.70/chromedriver_win32.zip
    If $iSize > 1 Then
        ProcessClose("chromedriver.exe")
        $oShell = ObjCreate ("Shell.Application")
        $FilesInZip = $oShell.NameSpace($sZipFile).items
        $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 20) ; 4 - Do not display a progress dialog box, 16 - Click "Yes to All" in any dialog box displayed
    EndIf
Else
    $iSize = 1
EndIf
If $iSize = 0 Then
    $sMsg &= @CRLF & "ChromeDriver.exe" & Chr(9) & Chr(9) & "Update failed"
ElseIf $iSize = 1 Then
    $sMsg &= @CRLF & "ChromeDriver.exe" & Chr(9) & Chr(9) & "Up to date"
Else
    FileWriteLine($hFile, _NowCalc() & " - ChromeDriver.exe" & Chr(9) & "(" & $sLatestVersion & ")")
    $sMsg &= @CRLF & "ChromeDriver.exe" & Chr(9) & Chr(9) & "Updated" ; "(" & $sLatestVersion & ")"
EndIf

; Install/Update WebDriver UDF
$sGithub = BinaryToString(InetRead("https://github.com/Danp2/WebDriver/releases/latest"), 4)
$hTime = TimerInit()
While 1
    If StringInStr($sGithub, '<a href="/Danp2/WebDriver/releases/tag/') Then
        ExitLoop
    EndIf
    Sleep(50)
    If TimerDiff($hTime) > 5000 Then
        $sGithub = ""
        ExitLoop
    EndIf
WEnd

$iSize = 0
If $sGithub <> "" Then
    $aResult = StringRegExp($sGithub, '<a href="/Danp2/WebDriver/releases/tag/(.*)">', 1)
    $sLatestVersion = $aResult[0]
    If FileExists($sDriverPath & "wd_core.au3") Then
        $sUDF = FileRead($sDriverPath & "wd_core.au3")
        $aResult = StringRegExp($sUDF, 'WDVERSION = \"\d*\.\d*\.\d*\.\d*', 1)
        $sCurrentVersion = StringMid($aResult[0], 14)
    Else
        $sCurrentVersion = "None"
    EndIf
    If $sLatestVersion <> $sCurrentVersion Then
        $sZipFile = $sDriverPath & "WebDriver-" & $sLatestVersion & ".zip"
        $iSize = InetGet("https://github.com/Danp2/WebDriver/archive/" & $sLatestVersion & ".zip", $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT)
        If $iSize > 1 Then
            $oShell = ObjCreate ("Shell.Application")
            $FilesInZip = $oShell.NameSpace($sZipFile).items
            $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 20)
            FileCopy($sDriverPath & "WebDriver-" & $sLatestVersion & "\*.*", $sDriverPath & "*.*", 1)
            DirRemove($sDriverPath & "WebDriver-" & $sLatestVersion, 1)
        EndIf
    Else
        $iSize = 1
    EndIf
EndIf
If $iSize = 0 Then
    $sMsg &= @CRLF & "WebDriver UDF" & Chr(9) & Chr(9) & "Update failed"
ElseIf $iSize = 1 Then
    $sMsg &= @CRLF & "WebDriver UDF" & Chr(9) & Chr(9) & "Up to date"
Else
    FileWriteLine($hFile, _NowCalc() & " - WebDriver UDF" & Chr(9) & Chr(9) & "(" & $sLatestVersion & ")")
    $sMsg &= @CRLF & "WebDriver UDF" & Chr(9) & Chr(9) & "Updated" ; "(" & $sLatestVersion & ")"
EndIf

; Install/Update WinHttp.au3
$sGithub = BinaryToString(InetRead("https://github.com/dragana-r/autoit-winhttp/releases"), 4)
$hTime = TimerInit()
While 1
    If StringInStr($sGithub, '<div class="release-entry">') Then
        ExitLoop
    EndIf
    Sleep(50)
    If TimerDiff($hTime) > 5000 Then
        $sGithub = ""
        ExitLoop
    EndIf
WEnd

$iSize = 0
If $sGithub <> "" Then
    $aResult = StringRegExp($sGithub, "/\d*\.\d*\.\d*\.\d*", 1)
    $sLatestVersion = StringMid($aResult[0], 2)

    If FileExists($sDriverPath & "WinHTTP.au3") Then
        $sUDF = FileRead($sDriverPath & "WinHTTP.au3")
        $aResult = StringRegExp($sUDF, ": \d*\.\d*\.\d*\.\d*", 1)
        $sCurrentVersion = StringMid($aResult[0], 3)
    Else
        $sCurrentVersion = "None"
    EndIf
    If $sLatestVersion <> $sCurrentVersion Then
        $aLink = StringRegExp($sGithub, "href=.*\.zip", 1)
        $sLink = "https://github.com" & StringMid($aLink[0], 7)
        ;<a href="/dragana-r/autoit-winhttp/releases/download/1.6.4.1/1.6.4.1.zip"
        $sZipFile = $sDriverPath & "WinHttp-" & $sLatestVersion & ".zip"
        $iSize = InetGet($sLink, $sZipFile, $INET_FORCERELOAD, $INET_DOWNLOADWAIT)

        If $iSize > 1 Then
            $oShell = ObjCreate ("Shell.Application")
            $FilesInZip = $oShell.NameSpace($sZipFile).items
            $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 20)
            FileCopy($sDriverPath & $sLatestVersion & "\*.*", $sDriverPath & "*.*", 1)
            DirRemove($sDriverPath & $sLatestVersion, 1)
        EndIf
    Else
        $iSize = 1
    EndIf
EndIf
If $iSize = 0 Then
    $sMsg &= @CRLF & "WinHttp.au3" & Chr(9) & Chr(9) & "Update failed"
ElseIf $iSize = 1 Then
    $sMsg &= @CRLF & "WinHttp.au3" & Chr(9) & Chr(9) & "Up to date"
Else
    FileWriteLine($hFile, _NowCalc() & " - WinHttp.au3" & Chr(9) & Chr(9) & "(" & $sLatestVersion & ")")
    $sMsg &= @CRLF & "WinHttp.au3" & Chr(9) & Chr(9) & "Updated" ; "(" & $sLatestVersion & ")"
EndIf

; Install/Update Json.au3 - I couldn't figure out how to determine the necessity of an update
$iSize = 0
If Not FileExists($sDriverPath & "Json.au3") Then
    $sZipFile = $sDriverPath & "Json.zip"
    $iSize = InetGet("https://www.autoitscript.com/forum/applications/core/interface/file/attachment.php?id=61831", $sZipFile)
    If $iSize > 0 Then
        $oShell = ObjCreate ("Shell.Application")
        $FilesInZip = $oShell.NameSpace($sZipFile).items
        $oShell.NameSpace($sDriverPath).CopyHere($FilesInZip, 20)
        FileWriteLine($hFile, _NowCalc() & " - Json.au3" & Chr(9) & Chr(9) & "Downloaded")
        $sMsg &= @CRLF & "WinHttp.au3" & Chr(9) & Chr(9) & "Downloaded"
    EndIf
Else
    $iSize = 1
EndIf
If $iSize = 0 Then
    $sMsg &= @CRLF & "Json.au3" & Chr(9) & Chr(9) & Chr(9) & "Update failed"
ElseIf $iSize = 1 Then
    $sMsg &= @CRLF & "Json.au3" & Chr(9) & Chr(9) & Chr(9) & "Existing"
Else
    $sMsg &= @CRLF & "Json.au3" & Chr(9) & Chr(9) & Chr(9) & "Downloaded"
EndIf

FileClose($hFile)

MsgBox(0, "WebDriver Updater", $sMsg, 120)

 

Edited by CYCho

Share this post


Link to post
Share on other sites

Hi Dan,

is it very difficult to add the webdriver for the new edge chromium (msedgedriver.exe) in _WD_UpdateDriver() ?

Share this post


Link to post
Share on other sites

Hey

Is it possible to delete an Element? So i can remove a navigation e.g. ?

Thanks in advance


why do i get garbage when i buy garbage bags? <_<

Share this post


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

You should be able to accomplish this using _WD_ExecuteScript and the appropriate Javascript.

Yeah i already thought about this, but couldn't get it work. 

I took some try and error time and now i got it ! :)

Local $JScript = _
     'var elem = document.getElementsByClassName("navigation-bar-wrapper size-content");' & _
     'elem[0].remove();'
    _WD_ExecuteScript ( $sSession,$JScript )

Thanks anyway


why do i get garbage when i buy garbage bags? <_<

Share this post


Link to post
Share on other sites

oh yes sorry i wanted to, but i was a bit confused because i had both open i guess

 

:oops:


why do i get garbage when i buy garbage bags? <_<

Share this post


Link to post
Share on other sites

v0.3.0.4 just released with the following changes --

    - Added: _WD_ExecuteCdpCommand (TheDcoder)
    - Changed (_WD_UpdateDriver): Add support for MSEdge (Chromium)
    - Changed (_WD_Shutdown): Allow shutdown of specific module by name or PID
    - Changed (_WD_Startup): Notify if WinHTTP UDF needs updated
    - Changed: Improved error handling / HTTP timeout detection

Share this post


Link to post
Share on other sites

v0.3.0.5 just released with the following changes --

    - Added: _WD_GetTable (danylarson / water)
    - Fixed (_WD_FindElement): Enforce relative xpath when utilizing a starting element
    - Changed: Use InetRead instead of __WD_Get (_WD_IsLatestRelease & _WD_UpdateDriver)
    - Changed: Pass Content-Type header in HTTP request

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Langmeister
      I am once again asking for your experienced assistance. If I open a website that uses notifications I am asked to allow or block them for that website after a few seconds. This notification pops up every time the page gets navigated to, even tho you have clicked on allow for several times. I am explicitly not searching for smth to get rid of "Chrome is being controlled by automated test sw". Instead I am searching for a line of script to disable all notifications by default: like here chrome://settings/content/notifications. 
      This is code should give you an example of what notifications I am talking about:
      #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession, $sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://webradio.planetradio.de/") _WD_LoadWait($sSession)  
    • By Langmeister
      Hi, I'm sure that this is a simple question regarding webdriver udf but my search on the forum did not result in the exact same scenario that I need. I will adapt it to my corporate needs but at first I want it to work with an example everybody can reproduce if needed.
      I navigate to https://www.daysoftheyear.com/ and want to find out what special day today is. Using the following Code returns the wanted text that today is 'shark awareness day' in the console but it is not pasted in notepad as it is not copied as it probably should be.
      #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession, $sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.daysoftheyear.com/?timezone_offset=nan") _WD_LoadWait($sSession) Sleep(3000) Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div[2]/header/div/div[1]/div/div[2]/h3/a") _WD_ElementAction($sSession, $sElement, 'text') ClipGet() Run("notepad.exe") Sleep(500) Send("^v") Scite returns this, therefore the text has been found but the last mile to paste it to notepad or excel does not work for me.
      __WD_Get: URL=HTTP://127.0.0.1:9515/session/b72166b774d7fefb258b3721fc1d4306/element/657e6b5d-31a9-46a8-85c4-acb7f72bf659/text __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"Shark Awareness Day"}... _WD_ElementAction: {"value":"Shark Awareness Day"}... Thanks in advance! 
       
    • By Langmeister
      Hi, I need help performing actions in Salesforce using IE. I used to complete tasks via MouseMove/MouseClick etc. on the Chrome application of SF, but unfortunately this only works for me and not my colleagues due to different positions of things etc. Being unable to get Webdriver UDF or Chromedriver running to interact with the code directly, I chose to look into the IE UDF. ATM I'm trying to tick a specific checkbox in SF which simply allows me to "select all checkboxes" at the same time. Applying the following code on a random website with checkboxes works just fine for me: (in this case selecting cheese checkbox)
      #include <IE.au3> Local $oIE = _IECreate("http://www.echoecho.com/htmlforms09.htm") Local $oSubmit = _IEGetObjByName($oIE, "option3") _IEAction($oSubmit, "click") _IELoadWait($oIE) But applying it to the Salesforce website it does exactly nothing and responds with these warnings/errors:
      The script is exactly the same, except for website and the input name tag of the desired checkbox being different.
      #include <IE.au3> Local $oIE = _IECreate("Corporate Salesforce URL") Local $oSubmit = _IEGetObjByName($oIE, "myPage:myForm:oliListBlock:oliListTable:j_id36") _IEAction($oSubmit, "click") _IELoadWait($oIE) As its working with random websites my guess is that there has to be something done to get it work with SF.
      Hope the more experienced SF+AutoIt pros can help me out here. Thanks in advance!
    • 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")  
×
×
  • Create New...