With this code the console window gets closed with version 0.3.0.3 but not with 0.3.0.4 and higher:
#include <wd_core.au3>
#include <wd_helper.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
Local $sSession, $sDesiredCapabilities
SetupChrome()
_WD_Startup()
If @error <> $_WD_ERROR_Success Then
Exit -1
EndIf
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Window($sSession, 'rect', '{"x":0,"y":0,"width":970,"height":800}')
GUICreate("test", 300, 670, 975, 3)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1)
;/ GUI erzeugen
While 1
Sleep(100)
WEnd
Func SetupChrome()
$browser = CheckBrowser('chrome')
_WD_Option('Driver', 'driver\chromedriver-' & $browser[0] & '.exe')
_WD_Option('Port', 9515)
;_WD_Option('DriverParams', '--verbose')
$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "prefs": {"credentials_enable_service": false} }}}}'
EndFunc
Func CheckBrowser($browser)
;https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-05252020/?do=findComment&comment=1443558
$sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\" & $browser & ".exe", "")
ConsoleWrite("Path: " & $sPath & @CRLF)
$aBrowserVersion = StringSplit(FileGetVersion($sPath), '.')
Dim $return[2]
$return[0] = $aBrowserVersion[1]
$return[1] = StringReplace($sPath, '\', '\\')
Return $return
EndFunc
Func _Exit()
_WD_DeleteSession($sSession)
_WD_Shutdown()
Exit
EndFunc ;==>_Exit