Jump to content

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


Danp2
 Share

Recommended Posts

My computer's default printer is a laserprinter. 
I have made a script using the webdriver UDF to automate login into our UPS/DHL website.
After adding a package, we must print a label on our labelprinter, however our script alsways default to the laserprinter the first time it's started.
If we do not close the session, the last selected printer (the label printer) keeps being the "selected" default until we accidentally close the session and start again.

Is there a way to make our label printer the default for our chrome script and leave the laserprinter as the Windows default?

Link to comment
Share on other sites

Hi,

I have tried to find the topic by search - no chance. 

Is there a function to get the actual browser versions of chrome, edge and firefox and the version of the loaded webdrivers?

Thanks for your help.

Link to comment
Share on other sites

@Danp2 That was great

Being that I'm just running chrome for now I just needed:

 

_WD_ExecuteScript($sSession, "document.body.style.zoom='4';")

 

I also found a trick which I might use in the future to add a highlighted note to the top of the body to notify my users:

 

_WD_ExecuteScript($sSession, "document.body.prepend('ABCDEF');")   ; Adds HTML inside body tag at the beginning
_WD_ExecuteScript($sSession, "document.body.append('GHIJKL');")    ; Adds HTML inside body tag to the end

 

Thanks again!

Link to comment
Share on other sites

@HJL This information is contained in the webdriver's response to a session creation request, which fortunately for you _WD_CreateSession save this response to the global variable $_WD_SESSION_DETAILS. You'll have to parse the desired value from the JSON string.

Note: The latest draft of the W3C specs now supports retrieving this session information at runtime. The next UDF release will contain the function _WD_GetSession, which implements this functionality. Once this is working properly with all browsers, it's likely that I will remove the $_WD_SESSION_DETAILS global as it will be redundant.

Link to comment
Share on other sites

46 minutes ago, HJL said:

Hi,

I have tried to find the topic by search - no chance. 

Is there a function to get the actual browser versions of chrome, edge and firefox and the version of the loaded webdrivers?

Thanks for your help.

Maybe this wi help, just click on the Wiki FAQs in the post from Danp2.
And look for 

_WD_UpdateDriver Replace web driver with newer version, if available

This function will probably autoupdate the chromedriver and other drivers in the script folder.
I think however your script must have write rights in the  folder.
I use a folder in Program Files, you definetely have to grant permission for the user or for the group users to update the driver.
If you really want to I might be able to post some snippets from my program, how I check the version and do the update.

Link to comment
Share on other sites

@Jemboy: some snippets are welcome 😉 UpdateDriver has the problem with permissions and I don't want to change them.

@danp2: works fine for chrome and firefox, but edge 89/45 with webdriver 89/45 brings error 10 and does not deliver $_WD_SESSION_DETAILS. Something must be wrong with this new versions for edge? Did anyone test it? How can I find out the reason for this error?

 

Link to comment
Share on other sites

@HJL Edge is working fine for me. This is the return info I just --

_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"msedge","browserVersion":"89.0.774.45","ms:edgeOptions":{"debuggerAddress":"localhost:62914"},"msedge":{"msedgedriverVersion":"88.0.705.81 (324d415ccf2f0dac8fa87e00b3e07b69f8d3d9e6)","userDataDir":"C:\\Users\\danpxxxxx\\AppData\\Local\\Temp\\scoped_dir1524_2089897837"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"58c2132a0868b075c7f59025b80da04a"}}

And I just updated to the latest version of edgedriver without any issues --

_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"msedge","browserVersion":"89.0.774.45","ms:edgeOptions":{"debuggerAddress":"localhost:63334"},"msedge":{"msedgedriverVersion":"89.0.774.45 (bb55f48a0d369c43828d1b214a80c5166f640ee2)","userDataDir":"C:\\Users\\danpxxxxx\\AppData\\Local\\Temp\\scoped_dir32520_668524650"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"b37852f2364211e35653d371d21eaa9c"}}

Please post further details regarding the error you are receiving.

Link to comment
Share on other sites

@HJL This is the code I am using to autoupdate Chromedriver.exe. 

$CDVer = GetCDVersion ()
$ChVer = GetChromeVersion ()
;__MsgBox (0,$sTitle,"Chrome version: " & $ChVer & @CRLF & "Chromedriver version: " & $CDVer)
If $ChVer>$CDVer then
    If DownloadNewCD ($ChVer)=True then
        TempUnzipCD ()
        MoveCD ()
        Beep (500,250)
    EndIf
EndIf

Func GetCDVersion ()
    $CDVersion = 84                                                         ; Force Chromedriver download if non on scriptdir
    If FileExists (@ScriptDir & "\chromedriver.exe") Then
        Local $iPID = Run (@ScriptDir & "\chromedriver.exe -v",@ScriptDir, @SW_HIDE, $STDOUT_CHILD)
        ProcessWaitClose($iPID,5)
        Local $sOutput = StdoutRead($iPID)                              ; Read the Stdout stream of the PID returned by Run.
        $CDVersion = StringLeft ($sOutput, StringInStr ($sOutput,".")-1)    ; Get string up to first .
        $CDVersion = StringRegExpReplace($CDVersion, "\D", "")          ; Get rid of all non-digits
        If $CDVersion<84 then ExitProgram ("Error retrieving Chromedriver version." & @CRLF & "Please contact your administrator.", 2)
    EndIf
    Return $CDVersion
EndFunc

Func GetChromeVersion ()
;https://www.ghacks.net/2020/06/11/google-chrome-is-soon-going-to-be-installed-in-a-different-directory-on-windows/
    If FileExists ("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") Then
        $ChromeVersion = FileGetVersion("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
        $ChromeVersion = StringLeft ($ChromeVersion, StringInStr ($ChromeVersion,".")-1)
    ElseIf "C:\Program Files\Google\Chrome\Application\chrome.exe" then
        $ChromeVersion = FileGetVersion("C:\Program Files\Google\Chrome\Application\chrome.exe")
        $ChromeVersion = StringLeft ($ChromeVersion, StringInStr ($ChromeVersion,".")-1)
    Else
        ExitProgram ("Chrome.exe could not be found in known locations." & @CRLF & "Can not check or update Chrome version!", 3)
    EndIf
    Return $ChromeVersion
EndFunc

Func DownloadNewCD ($sChromeVersion)
    ;https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection
    Local $CDText=BinaryToString(InetRead("https://chromedriver.storage.googleapis.com/LATEST_RELEASE_" & $sChromeVersion))

    ;https://chromedriver.storage.googleapis.com/<chrome version>/chromedriver_win32.zip
    Local $iBytesSize = InetGet("https://chromedriver.storage.googleapis.com/" & $CDText & "/chromedriver_win32.zip", @TempDir & "\chromedriver_win32.zip", $INET_FORCERELOAD,  $INET_DOWNLOADWAIT  )
    Local $ResDL = @error
    Local $iFileSize = FileGetSize(@TempDir & "\chromedriver_win32.zip") ; Retrieve the filesize.

    If ($iBytesSize<>$iFileSize) or ($ResDL<>0) then ExitProgram ("Chromedriver did not download correctly." & @CRLF & "Please contact your administrator.", 4)
    Return True
EndFunc

Func TempUnzipCD ()
    DirRemove(@TempDir & "\chromedriver", $DIR_REMOVE)
    UnZip(@TempDir & "\chromedriver_win32.zip", @TempDir & "\chromedriver")
    If @error Then ExitProgram ("Chromedriver did not UNZIP correctly." & @CRLF & "Please contact your administrator.", 5)
    Return True
EndFunc


Func MoveCD ()
    ;__MsgBox (0,$sTitle,"ScriptDir = " & @ScriptDir)
    $RetMCD = FileCopy(@TempDir & "\chromedriver\*.exe", @ScriptDir, $FC_OVERWRITE) ;Move file to scriptdir
    If $RetMCD<>1 then ExitProgram ("Could not copy Chromedriver to script folder." & @CRLF & "Please contact your administrator.", 6)
EndFunc

Func ExitProgram ($ExitMsg, $ExitCode)
    MsgBox($MB_SYSTEMMODAL, $sTitle,$ExitMsg)
    KillChromeDriver ()
    Exit $ExitCode
EndFunc

;--------------------------------------------------------------------------------------
;https://www.autoitscript.com/forum/topic/139249-unzip-a-zip/
;(c)2019 Nine
;--------------------------------------------------------------------------------------
Func UnZip($sZipFile, $sDestFolder)
  If Not FileExists($sZipFile) Then Return SetError (1) ; source file does not exists
  If Not FileExists($sDestFolder) Then
    If Not DirCreate($sDestFolder) Then Return SetError (2) ; unable to create destination
  Else
    If Not StringInStr(FileGetAttrib($sDestFolder), "D") Then Return SetError (3) ; destination not folder
  EndIf
  Local $oShell = ObjCreate("shell.application")
  Local $oZip = $oShell.NameSpace($sZipFile)
  Local $iZipFileCount = $oZip.items.Count
  If Not $iZipFileCount Then Return SetError (4) ; zip file empty
  For $oFile In $oZip.items
    $oShell.NameSpace($sDestFolder).copyhere($ofile,4)  ; https://docs.microsoft.com/en-us/windows/win32/shell/folder-copyhere
  Next
EndFunc   ;==>UnZip

 

 

During installation I use the following snippet to adjust right on the folder in which my script is installed. I have chosen to give "change" right to the local group "Users"
However you could just adjust the permission on the chromedriver.exe only and specifiy the permission for one user, if you want to be more security minded.
You need ofcourse one time  "admin" rights to adjust the folder permission, this is how Windows works🙂

$ProgPath =  "C:\Program Files\MyWebProg" 
$LocalizedUserName = _GroupGetNameBySID("S-1-5-32-545")                                                             ; *S-1-5-32-545 == Users/Gebruikers SID
Local $iReturn = RunWait(@ComSpec & ' /c CACLS "' & $ProgPath & '" /E /T /C /P "' & $LocalizedUserName & '":C', @ScriptDir, @SW_HIDE)


;https://www.autoitscript.com/forum/topic/74118-local-account-udf/?tab=comments#comment-1222028
Func _GroupGetNameBySID($sSID, $sComputer = @ComputerName)
    Local $objSystem = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2")
    Local $objGroupList = $objSystem.ExecQuery('Select * from Win32_Group Where Domain="' & $sComputer & '" And SID="' & $sSID & '"')
    For $objGroup In $objGroupList ; should be only a single result, anyway returns the first result found
        Return $objGroup.Name
    Next
    Return SetError(1, 0, '')
EndFunc   ;==>_GroupGetNameBySID

 

Link to comment
Share on other sites

You can always read registry :

HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon\version

HKEY_CURRENT_USER\Software\Microsoft\Edge\BLBeacon\version

Edited by Nine
Link to comment
Share on other sites

Edge: _WD_CreateSession $sResponse: WinHTTP request timed out before Webdriver

Chrome: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"89.0.4389.82","chrome":{"chromedriverVersion":"89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})","userDataDir":"C:/Webdriver/CHROME_WD_Profile"},"goog:chromeOptions":{"debuggerAddress":"localhost:62145"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"5825690ffaae702cb9490139f0f004a7"}}

Edited by HJL
Link to comment
Share on other sites

 

3 hours ago, Danp2 said:

@HJL Have you tried removing the "binary" portion of the DesiredCapabilities string? Someone else recently reported that they had to do this to get Edge to load correctly?

If that isn't it, then post a short reproducer along with the full results from the Scite output panel.

What do you mean with removing binary portion? 
I use $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"w3c": true, "args":["user-data-dir=' & $sEdgeProfil & '"]}}}}' and that worked fine a couple of days ago.
 

If that isn't it, then post a short reproducer along with the full results from the Scite output panel.

What must I do to get that what you want in Scite output panel? Set some log variable to True?

Link to comment
Share on other sites

17 minutes ago, HJL said:

What must I do to get that what you want in Scite output panel? Set some log variable to True?

This is controlled by the global variable $_WD_DEBUG. The default is

$_WD_DEBUG = $_WD_DEBUG_Info

so you shouldn't have to do anything unless you've overridden it.

The string you posted doesn't contain the "binary" portion, so you can ignore my earlier comment. You could have saved both of us some time had you shared your code earlier. 😉

Link to comment
Share on other sites

 

10 hours ago, Danp2 said:

This is controlled by the global variable $_WD_DEBUG. The default is

$_WD_DEBUG = $_WD_DEBUG_Info

so you shouldn't have to do anything unless you've overridden it (I did).

The string you posted doesn't contain the "binary" portion, so you can ignore my earlier comment. You could have saved both of us some time had you shared your code earlier. 😉

Sorry, I have just startet coding again after some month and I have to "get in" again. 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Webdriver\Entwicklung\BlpMenu.au3" /UserParams    
+>11:24:26 Starting AutoIt3Wrapper (19.1127.1402.0} from:SciTE.exe (4.2.0.0)  Keyboard:00000407  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0407)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\lenzen\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\lenzen\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Webdriver\Entwicklung\BlpMenu.au3
C:\Webdriver\Entwicklung\BlpMenu.au3 - 0 error(s), 0 warning(s)
->11:24:27 AU3Check ended. Press F4 to jump to next error.rc:1
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Webdriver\Entwicklung\BlpMenu.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
__WD_Get: URL=HTTP://127.0.0.1:0/session//window/handles
__WD_Get: StatusCode=0; $iResult = 6; $sResponseText=WinHTTP request timed out before Webdriver...
__WD_Get ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_Window: WinHTTP request timed out before Webdriver...
_WD_Window ==> Send / Recv error: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:0/session//window/handles
__WD_Get: StatusCode=0; $iResult = 6; $sResponseText=WinHTTP request timed out before Webdriver...
__WD_Get ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_Window: WinHTTP request timed out before Webdriver...
_WD_Window ==> Send / Recv error: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:0/session//window/handles
__WD_Get: StatusCode=0; $iResult = 6; $sResponseText=WinHTTP request timed out before Webdriver...
__WD_Get ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_Window: WinHTTP request timed out before Webdriver...
_WD_Window ==> Send / Recv error: HTTP status = 0
_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_10 WIN32_NT 19042 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.4.0.1 (Up to date)
_WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)
_WDStartup: Driver: i:\BlpMenu\Webdriver\msedgedriver.exe
_WDStartup: Params: --log-path="c:\webdriver\edge.log"
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"w3c": true, "args":["user-data-dir=C:/Webdriver/EDGE_WD_Profile"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window/handles
__WD_Get: StatusCode=404; $iResult = 15; $sResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Get ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF7C35E98D2+170194]\n\tGetHandleVerifier [0x00007FF7C3D4C0A2+2219282]\n\tGetHandleVerifier [0x00007FF7C3D74813+2385027]\n\tGetHandleVerifier [0x00007FF7C3D973CB+2527291]\n\tGetHandleVerifier [0x00007FF7C3D95326+2518934]\n\tGetHandleVerifier [0x00007FF7C3D2CDE2+2091602]\n\tOrdinal0 [0x00007FF7C36038C1+276673]\n\tGetHandleVerifier [0x00007FF7C3E17060+3050704]\n\tGetHandleVerifier [0x00007FF7C3E19D7E+3062254]\n\tGetHandleVerifier [0x00007FF7C3E178E8+3052888]\n\tOrdinal0 [0x00007FF7C3753410+1651728]\n\tGetHandleVerifier [0x00007FF7C3D2BEA0+2087696]\n\tGetHandleVerifier [0x00007FF7C3E55AC8+3307320]\n\tBaseThreadInitThunk [0x00007FFFFC137034+20]\n\tRtlUserThreadStart [0x00007FFFFD8FD241+33]\n"}}
_WD_Window: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_Window ==> Invalid session ID: HTTP status = 404
__WD_Get: URL=HTTP://127.0.0.1:9515/session//window/handles
__WD_Get: StatusCode=404; $iResult = 15; $sResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
__WD_Get ==> Invalid session ID: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOrdinal0 [0x00007FF7C35E98D2+170194]\n\tGetHandleVerifier [0x00007FF7C3D4C0A2+2219282]\n\tGetHandleVerifier [0x00007FF7C3D74813+2385027]\n\tGetHandleVerifier [0x00007FF7C3D973CB+2527291]\n\tGetHandleVerifier [0x00007FF7C3D95326+2518934]\n\tGetHandleVerifier [0x00007FF7C3D2CDE2+2091602]\n\tOrdinal0 [0x00007FF7C36038C1+276673]\n\tGetHandleVerifier [0x00007FF7C3E17060+3050704]\n\tGetHandleVerifier [0x00007FF7C3E19D7E+3062254]\n\tGetHandleVerifier [0x00007FF7C3E178E8+3052888]\n\tOrdinal0 [0x00007FF7C3753410+1651728]\n\tGetHandleVerifier [0x00007FF7C3D2BEA0+2087696]\n\tGetHandleVerifier [0x00007FF7C3E55AC8+3307320]\n\tBaseThreadInitThunk [0x00007FFFFC137034+20]\n\tRtlUserThreadStart [0x00007FFFFD8FD241+33]\n"}}
_WD_Window: {"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"Backtrace:\n\tOr...
_WD_Window ==> Invalid session ID: HTTP status = 404

-------------------------------------

Starting MSEdgeDriver 89.0.774.45 (bb55f48a0d369c43828d1b214a80c5166f640ee2) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully.
[12776:15120:0309/112506.228:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.

DevTools listening on ws://127.0.0.1:56903/devtools/browser/9922b46c-4fc2-4fc2-873d-b8156294288c
[12776:13888:0309/112506.410:ERROR:edge_auth_errors.cc(381)] EDGE_IDENTITY: Get Default OS Account failed: Error: Primary Error: kImplicitSignInFailure, Secondary Error: kAccountProviderFetchError, Platform error: 0, Error string:

[12776:15120:0309/112506.498:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.

------------------------------------
chrome_debug.log:
[12776:15120:0309/112506.223:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 1 time(s)
[12776:15120:0309/112506.224:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 2 time(s)
[12776:15120:0309/112506.224:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 3 time(s)
[12776:15120:0309/112506.225:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 4 time(s)
[12776:15120:0309/112506.226:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 5 time(s)
[12776:15120:0309/112506.227:WARNING:gpu_process_host.cc(1298)] The GPU process has crashed 6 time(s)
[12776:15120:0309/112506.228:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.
[12776:3312:0309/112506.248:WARNING:backend_impl.cc(1856)] Destroying invalid entry.
[12776:13888:0309/112506.275:INFO:collections_sync_bridge.cc(107)] CollectionsSyncBridge::CollectionsSyncBridge - Started
[12776:13888:0309/112506.410:ERROR:edge_auth_errors.cc(381)] EDGE_IDENTITY: Get Default OS Account failed: Error: Primary Error: kImplicitSignInFailure, Secondary Error: kAccountProviderFetchError, Platform error: 0, Error string: 

[12776:15120:0309/112506.498:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.
[12776:13888:0309/112606.470:WARNING:pref_notifier_impl.cc(40)] Pref observer for media_router.cast_allow_all_ips found at shutdown.

And what happens with bluetooth_adapter???

Starting ChromeDriver 89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294}) on port 9715
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

DevTools listening on ws://127.0.0.1:57238/devtools/browser/4f733dfd-13bb-4c75-97d9-4a5ab931e05e
[21292:8600:0309/114453.054:ERROR:device_event_log_impl.cc(214)] [11:44:53.054] Bluetooth: bluetooth_adapter_winrt.cc:1072 Getting Default Adapter failed.

Edited by HJL
BlueTooth
Link to comment
Share on other sites

15 hours ago, Nine said:

You can always read registry :

HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon\version

HKEY_CURRENT_USER\Software\Microsoft\Edge\BLBeacon\version

Thanks!

Is there a chance to find out the firefox version? HKEY_CURRENT_USER\SOFTWARE\Mozilla\Mozilla Firefox 86.0\GeckoVer contains the version already in the path and I don't  know how to handle the path with changing versions inside.

### found it: RegRead("HKEY_CURRENT_USER\SOFTWARE\Mozilla\Mozilla Firefox", "CurrentVersion") 

### but still interested how to handle a regkey with a changing part within, "*" works?

And is there a chance to find out the versions of the webdrivers (msedgedriver.exe, chromedriver.exe, geckodriver.exe) without starting them?

Edited by HJL
Link to comment
Share on other sites

31 minutes ago, HJL said:

Is there a chance to find out the firefox version?

I do not have Firefox installed.  But you can read a whole section with RegEnumKey/RegEnumVal (look help file example to learn how to do it).

31 minutes ago, HJL said:

And is there a chance to find out the versions of the webdrivers without starting them?

Not that I know. File has not set its version property (on chrome) but it does have the version in msedgedriver.exe (use FileGetVersion)

Edited by Nine
Link to comment
Share on other sites

@HJL You didn't post your code, but it appears you have a couple of issues --

  • Calling various webdriver commands before calling _WD_Startup.
  • You need to update your WinHTTP source as indicated by this --
    _WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)

P.S. Pretty sure the bluetooth issue with Chromedriver is benign

Link to comment
Share on other sites

4 hours ago, Danp2 said:

@HJL You didn't post your code, but it appears you have a couple of issues --

  • Calling various webdriver commands before calling _WD_Startup.
  • You need to update your WinHTTP source as indicated by this --
    _WDStartup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)

P.S. Pretty sure the bluetooth issue with Chromedriver is benign

My code has more than 4.000 lines 😞 But with your hints I corrected some issues with calling webdriver commands to early and changed WinHttp to the new one.

But edge still has problems with webdriver although the "normal" start works without problems.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Webdriver\Entwicklung\BlpMenu.au3" /UserParams    
+>18:43:42 Starting AutoIt3Wrapper (19.1127.1402.0} from:SciTE.exe (4.2.0.0)  Keyboard:00000407  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0407)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\lenzen\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\lenzen\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Webdriver\Entwicklung\BlpMenu.au3
+>18:43:43 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Webdriver\Entwicklung\BlpMenu.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
!Chrome: 89.0.4389.82 Edge: 89.0.774.45 FF: 86.0 (x64 de) (aus Registry) ChromeDriver: unknown EdgeDriver: 89.0.774.45
_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WDStartup: OS: WIN_10 WIN32_NT 19042 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.4.0.1 (Up to date)
_WDStartup: WinHTTP:    1.6.4.2
_WDStartup: Driver: i:\BlpMenu\Webdriver\msedgedriver.exe
_WDStartup: Params: --log-path="c:\webdriver\edge.log"
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"w3c": true, "args":["user-data-dir=C:/Webdriver/EDGE_WD_Profile"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

=======================================================================

Starting MSEdgeDriver 89.0.774.45 (bb55f48a0d369c43828d1b214a80c5166f640ee2) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully.
[23080:12304:0309/184357.291:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.

DevTools listening on ws://127.0.0.1:64125/devtools/browser/5304f214-7579-426d-b5ba-88082daee551
[23080:11804:0309/184357.467:ERROR:edge_auth_errors.cc(381)] EDGE_IDENTITY: Get Default OS Account failed: Error: Primary Error: kImplicitSignInFailure, Secondary Error: kAccountProviderFetchError, Platform error: 0, Error string:

[23080:12304:0309/184357.499:ERROR:browser_gpu_channel_host_factory.cc(154)] Failed to launch GPU process.

======================================================================

 

Link to comment
Share on other sites

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

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...