-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathCapabilities.ahk
74 lines (64 loc) · 2.54 KB
/
Capabilities.ahk
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
class capabilities
{
static Simple := {"capabilities":{"":""}}
__new(browser,Options,platform:="windows",notify:=false)
{
this.options := Options
this.cap := {}
this.cap.capabilities := {}
this.cap.capabilities.alwaysMatch := { this.options :{"w3c":json.true}}
this.cap.capabilities.alwaysMatch.browserName := browser
this.cap.capabilities.alwaysMatch.platformName := platform
if(notify = false)
this.AddexcludeSwitches("enable-automation")
this.cap.capabilities.firstMatch := [{}]
this.cap.desiredCapabilities := {}
this.cap.desiredCapabilities.browserName := browser
}
Setbinary(location)
{
this.cap.capabilities.alwaysMatch[this.Options].binary := StrReplace(location, "\", "/")
}
addArg(arg) ; args links https://peter.sh/experiments/chromium-command-line-switches/
{
if !IsObject(this.cap.capabilities.alwaysMatch[this.Options].args)
this.cap.capabilities.alwaysMatch[this.Options].args := []
this.cap.capabilities.alwaysMatch[this.Options].args.push(arg)
}
Addextensions(crxlocation)
{
if !IsObject(this.cap.capabilities.alwaysMatch[this.Options].extensions)
this.cap.capabilities.alwaysMatch[this.Options].extensions := []
crxlocation := StrReplace(crxlocation, "\", "/")
this.cap.capabilities.alwaysMatch[this.Options].extensions.push(crxlocation)
}
DebugPort(Port:=9515)
{
this.cap.capabilities.alwaysMatch[this.Options].debuggerAddress := "http://127.0.0.1:" Port
}
AddexcludeSwitches(switch)
{
if !IsObject(this.cap.capabilities.alwaysMatch[this.Options].excludeSwitches)
this.cap.capabilities.alwaysMatch[this.Options].excludeSwitches := []
this.cap.capabilities.alwaysMatch[this.Options].excludeSwitches.push(switch)
}
setUserProfile(profileName:="Default", userDataDir:="") ; user data dir doesnt change often, use the default
{
if !userDataDir
userDataDir := "C:/Users/" A_UserName "/AppData/Local/Google/Chrome/User Data"
userDataDir := StrReplace(userDataDir, "\", "/")
this.addArg("--user-data-dir=" userDataDir)
this.addArg("--profile-directory=" profileName)
}
/*
Following methods can manually be added as I haven't used them and do not know their parameters and also I don't see the need to add
ChromeOption Methods
detach
localState
prefs
minidumpPath
mobileEmulation
perfLoggingPrefs
windowTypes
*/
}