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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# File 'lib/mushy/fluxs/browser.rb', line 4
def self.details
{
name: 'Browser',
title: 'Use a browser',
fluxGroup: { name: 'Web' },
description: 'Visit a page in a browser.',
config: {
url: {
description: 'The URL to visit.',
type: 'text',
value: 'https://www.google.com'
},
headless: {
description: 'Run this browser headless.',
type: 'boolean',
shrink: true,
value: ''
},
timeout: {
description: 'The default timeout (in seconds) before closing the browser. Default is 5 seconds.',
type: 'integer',
shrink: true,
value: ''
},
execute: {
description: 'Javascript to run after the page is loaded.',
type: 'textarea',
shrink: true,
value: ''
},
cookies: {
description: 'Cookies for the web request. These can be received from a previous browser event with {{cookies}}, or can be typed manually.',
type: 'editgrid',
shrink: true,
value: [],
editors: [
{ id: 'name', target: 'name', field: { type: 'text', value: '', default: '' } },
{ id: 'value', target: 'value', field: { type: 'text', value: '', default: '' } },
{ id: 'domain', target: 'domain', field: { type: 'text', value: '', default: '' } },
{ id: 'path', target: 'path', field: { type: 'text', value: '', default: '' } },
{ id: 'expires', target: 'expires', field: { type: 'text', value: '', default: '' } },
{ id: 'size', target: 'size', field: { type: 'integer', value: 0, default: 0 } },
{ id: 'httpOnly', target: 'httpOnly', field: { type: 'boolean', value: false, default: false } },
{ id: 'secure', target: 'secure', field: { type: 'boolean', value: true, default: true } },
{ id: 'sameSite', target: 'sameSite', field: { type: 'text', value: 'None', default: 'None' } },
{ id: 'priority', target: 'priority', field: { type: 'text', value: 'Medium', default: 'Medium' } },
]
},
carry_cookies_from: {
description: 'Carry the cookies from this path in the event. Defaults to "cookies".',
type: 'text',
shrink: true,
value: ''
},
headers: {
description: 'Headers for the web request. These can be received from a previous browser event with {{headers}}, or can be typed manually.',
type: 'keyvalue',
shrink: true,
value: {}
},
carry_headers_from: {
description: 'Carry the headers from this path in the event. Defaults to "headers".',
type: 'text',
shrink: true,
value: ''
},
wait_before_closing: {
description: 'Wait this many seconds before closing the browser.',
type: 'integer',
shrink: true,
value: ''
}
},
examples: {
'Successful Call' => {
description: 'This will open https://www.google.com and return the result.',
config: { url: "https://www.google.com" },
result: {
url: 'https://www.google.com/',
status: 200,
title: 'Google',
cookies: [
{
name: '1P_JAR',
value: '2021-10-06-12',
domain: '.google.com',
path: '/',
expires: 1636117150.583117,
size: 19,
httpOnly: false,
secure: true,
session: false,
sameSite: 'None',
priority: 'Medium'
}
],
headers: {},
time: 1.486214604,
body: '<html itemscope="" itemtype="http://schema.org/WebPage" lang="en">...</html>'
}
},
'Login To a Site' => {
description: 'This will open https://www.yoursitepleasethankyou.com, login using javascript, and then return the state of the browser after logging in.',
input: {
url: 'https://www.yoursitepleasethankyou.com',
username: 'MYUSERNAME',
password: 'MYPASSWORD'
},
config: {
url: '{{url}}',
timeout: 10,
execute: "$('#username').val('{{username}}');
$('#next').click();
$('#password').val('{{password}}');
$('#login').click();"
},
result: {
url: 'https://yoursitepleasethankyou/',
status: 200,
title: '',
cookies: [
{
name: 'session_id',
value: '1jfujsx5xbnuxmsjmgjhzfpi',
domain: '.yoursitepleasethankyou',
path: '/',
expires: -1,
size: 41,
httpOnly: true,
secure: true,
session: true,
sameSite: 'Lax',
priority: 'Medium'
}
],
headers: {},
time: 4.633920809,
body: '<html xmlns="http://www.w3.org/1999/xhtml"><head></head>...</html>'
}
},
'Access a Page After Logging In' => {
description: 'This will open a page using cookies from the previous request. Note that the cookies came from another browser flux event.',
input: {
url: 'https://yoursitepleasethankyou/',
cookies: [
{
name: 'session_id',
value: '1jfujsx5xbnuxmsjmgjhzfpi',
domain: '.yoursitepleasethankyou',
path: '/',
expires: -1,
size: 41,
httpOnly: true,
secure: true,
session: true,
sameSite: 'Lax',
priority: 'Medium'
}
]
},
config: {
url: 'https://www.yoursitepleasethankyou.com/myaccount',
carry_cookies_from: '{{cookies}}'
},
result: {
url: 'https://yoursitepleasethankyou/',
status: 200,
title: '',
cookies: [
{
name: 'session_id',
value: '1jfujsx5xbnuxmsjmgjhzfpi',
domain: '.yoursitepleasethankyou',
path: '/',
expires: -1,
size: 41,
httpOnly: true,
secure: true,
session: true,
sameSite: 'Lax',
priority: 'Medium'
}
],
headers: {},
time: 4.633920809,
body: '<html><head></head>Your name is John Doe...</html>'
}
}
}
}
end
|