Files
004_comission/armandarmand/task1/task1-ticket1/_ref/VBScript/DownloadFile(Chrome).vbs
louiscklaw ce9a4aa9b3 update,
2025-01-31 19:27:58 +08:00

31 lines
2.1 KiB
Plaintext


' ---------------------------------------------------------------------------------------
' Set the browser to automatically download files without popup to a target folder
' ---------------------------------------------------------------------------------------
Class Script
Dim driver
Sub Class_Initialize
folder = Replace(WScript.ScriptFullName, WScript.ScriptName,"") & "chrome_download"
Set driver = CreateObject("Selenium.ChromeDriver")
driver.SetPreference "download.default_directory", folder
driver.SetPreference "download.directory_upgrade", True
driver.SetPreference "download.prompt_for_download", False
driver.SetPreference "plugins.plugins_disabled", Array("Chrome PDF Viewer")
driver.Get "http://static.mozilla.com"
driver.Get "/moco/en-US/pdf/mozilla_privacypolicy.pdf"
WScript.Echo "Click OK to close the browser"
End Sub
Sub Class_Terminate
driver.Quit
End Sub
End Class
Set s = New Script