Opt("TrayAutoPause", 0) Opt("TrayIconDebug", 0) #include #include #include #include Local $username = $CmdLine[1] Local $password = $CmdLine[2] Local $asset = $CmdLine[3] Local $sDesiredCapabilities, $sSession ; We use Chrome in this script. For other browsers lookup the functions below. SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) ; Hide the WebDriver console _WD_ConsoleVisible(false) ; Navigate to asset website _WD_Navigate($sSession, 'https://' & $asset) ;_BlockInput($BI_DISABLE) sleep(1000) While 1 If WinActive("Privacy error - Google Chrome", "") Then $hWnd = WinGetHandle ( "[ACTIVE]" ) $ret = DllCall ( "user32.dll" , "long" , "LoadKeyboardLayout" , "str" , "08040804" , "int" , 1 + 0 ) DllCall ( "user32.dll" , "ptr" , "SendMessage" , "hwnd" , $hWnd , "int" , 0x50 , "int" , 1 , "int" , $ret [ 0 ] ) ;send("thisisunsafe") ControlSend("Privacy error - Google Chrome", "", '', 'thisisunsafe') sleep(100) ElseIf WinActive("Login - VMware ESXi - Google Chrome", "") Then $hWnd = WinGetHandle ( "[ACTIVE]" ) $ret = DllCall ( "user32.dll" , "long" , "LoadKeyboardLayout" , "str" , "08040804" , "int" , 1 + 0 ) DllCall ( "user32.dll" , "ptr" , "SendMessage" , "hwnd" , $hWnd , "int" , 0x50 , "int" , 1 , "int" , $ret [ 0 ] ) ExitLoop Else WinWait("Login - VMware ESXi - Google Chrome", "", 5) EndIf WEnd sleep(1000) ; Set the username field of the local login form $userFieldXPath = '//*[@id="username"]' $userField = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $userFieldXPath) _WD_ElementAction($sSession, $userField, 'value', $username) ; Set the password field of the login form $passwordFieldXPath = '//*[@id="password"]' $passwordField = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $passwordFieldXPath) _WD_ElementAction($sSession, $passwordField, 'value', $password) ; Click the login button $loginButtonXPath = '//*[@id="loginButtonRow"]/button' $loginButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $loginButtonXPath) _WD_ElementAction($sSession, $loginButton, 'click') _BlockInput($BI_ENABLE) Func SetupChrome() _WD_Option('Driver', 'chromedriver114\chromedriver.exe') _WD_Option('Port', 9515) ; _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') ; Add chromeOption to not offer saving credentials $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "prefs": { "credentials_enable_service": false, "profile": { "password_manager_enabled": false}}} }}}' EndFunc ;==>SetupChrome