I am running a basic script which picks up URL, Username and Password as command line parameters and initiates a web session on a RDS server as a remote application. But the session is always initiated with default Chrome settings and maps default downloads folder to the session. So I want to map the network drive as download location every time script is executed. I am really new to AutoIT so any help is much appreciated. I am really new to AutoIT so any suggestions are welcome. The code looks like:
Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}'
EndFunc
If $CmdLine[0] <> 3 Then
MsgBox($MB_OK, "Usage", "ps_palo <hostname> <username> <password>")
Else
palo_login($CmdLine[1],$CmdLine[2],$CmdLine[3])
EndIf
Func palo_login($url,$username,$password)
Local $string, $sButton
$sSession = _WD_CreateSession($sDesiredCapabilities)
$string= "https://" & $url
_WD_Navigate($sSession,$string)
;Sleep(5000)
;_WD_LinkClickByText($sSession,"Continue to this website (not recommended).")
_ChromeSetInputValueById($sSession,"user",$username)
Sleep(1000)
_ChromeSetInputValueById($sSession,"passwd",$password)
Sleep(1000)
$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='submit']")
_WD_ElementAction($sSession, $sButton, 'click')
EndFunc ;==>PaloAlto_login()
Func _ChromeSetInputValueById($sSession,$Id,$Value)
Local $sElement
$sElement=_WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='"&$Id&"']")
_WD_ElementAction($sSession,$sElement,'value',$value)
EndFunc
;_WD_DeleteSession($sSession)
;_WD_Shutdown()