forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloadFile(Chrome).vbs
More file actions
30 lines (22 loc) · 2.1 KB
/
DownloadFile(Chrome).vbs
File metadata and controls
30 lines (22 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
' ---------------------------------------------------------------------------------------
' 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