topological-nodered-wdio 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +15 -15
- package/examples/basic.json +332 -332
- package/package.json +43 -43
- package/src/alert-action.html +79 -79
- package/src/alert-action.js +52 -52
- package/src/browser-action.html +114 -114
- package/src/browser-action.js +70 -70
- package/src/delete-session.html +26 -26
- package/src/delete-session.js +29 -29
- package/src/dropdown-action.html +124 -124
- package/src/dropdown-action.js +50 -50
- package/src/element-action.html +133 -133
- package/src/element-action.js +105 -105
- package/src/element-check.html +90 -90
- package/src/element-check.js +62 -62
- package/src/execute-script.html +92 -92
- package/src/execute-script.js +40 -40
- package/src/explicit-wait.html +126 -126
- package/src/explicit-wait.js +48 -48
- package/src/frame-action.html +67 -67
- package/src/frame-action.js +38 -38
- package/src/implicit-wait-config.html +85 -85
- package/src/implicit-wait-config.js +41 -41
- package/src/new-session.html +96 -96
- package/src/new-session.js +107 -104
- package/src/wdio-common.js +155 -155
- package/src/window-action.html +91 -91
- package/src/window-action.js +43 -43
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "topological-nodered-wdio",
|
|
3
|
-
"description": "Open source WebdriverIO nodes for Node-RED",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"author": "topological",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/Topological-dev/topological-nodered-wdio.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"node-red",
|
|
13
|
-
"topological"
|
|
14
|
-
],
|
|
15
|
-
"node-red": {
|
|
16
|
-
"version": ">=2.0.0",
|
|
17
|
-
"nodes": {
|
|
18
|
-
"delete-session": "src/delete-session.js",
|
|
19
|
-
"element-action": "src/element-action.js",
|
|
20
|
-
"new-session": "src/new-session.js",
|
|
21
|
-
"browser-action": "src/browser-action.js",
|
|
22
|
-
"element-check": "src/element-check.js",
|
|
23
|
-
"alert-action": "src/alert-action.js",
|
|
24
|
-
"dropdown-action": "src/dropdown-action.js",
|
|
25
|
-
"window-action": "src/window-action.js",
|
|
26
|
-
"frame-action": "src/frame-action.js",
|
|
27
|
-
"execute-script": "src/execute-script.js",
|
|
28
|
-
"explicit-wait": "src/explicit-wait.js",
|
|
29
|
-
"implicit-wait-config": "src/implicit-wait-config.js"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@wdio/allure-reporter": "^7.19.7",
|
|
34
|
-
"@wdio/cli": "^
|
|
35
|
-
"webdriverio": "^
|
|
36
|
-
},
|
|
37
|
-
"publishConfig": {
|
|
38
|
-
"access": "public"
|
|
39
|
-
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=12.0.0"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "topological-nodered-wdio",
|
|
3
|
+
"description": "Open source WebdriverIO nodes for Node-RED",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"author": "topological",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Topological-dev/topological-nodered-wdio.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"node-red",
|
|
13
|
+
"topological"
|
|
14
|
+
],
|
|
15
|
+
"node-red": {
|
|
16
|
+
"version": ">=2.0.0",
|
|
17
|
+
"nodes": {
|
|
18
|
+
"delete-session": "src/delete-session.js",
|
|
19
|
+
"element-action": "src/element-action.js",
|
|
20
|
+
"new-session": "src/new-session.js",
|
|
21
|
+
"browser-action": "src/browser-action.js",
|
|
22
|
+
"element-check": "src/element-check.js",
|
|
23
|
+
"alert-action": "src/alert-action.js",
|
|
24
|
+
"dropdown-action": "src/dropdown-action.js",
|
|
25
|
+
"window-action": "src/window-action.js",
|
|
26
|
+
"frame-action": "src/frame-action.js",
|
|
27
|
+
"execute-script": "src/execute-script.js",
|
|
28
|
+
"explicit-wait": "src/explicit-wait.js",
|
|
29
|
+
"implicit-wait-config": "src/implicit-wait-config.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@wdio/allure-reporter": "^7.19.7",
|
|
34
|
+
"@wdio/cli": "^8.16.6",
|
|
35
|
+
"webdriverio": "^8.16.6"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=12.0.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/alert-action.html
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
function setAlertAction() {
|
|
3
|
-
let action = $('#node-input-action').val()
|
|
4
|
-
$('#actionSendText').hide()
|
|
5
|
-
if (action === 'sendAlertText') {
|
|
6
|
-
$('#actionSendText').show()
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
RED.nodes.registerType('alert-action', {
|
|
11
|
-
category: 'Webdriver IO',
|
|
12
|
-
color: '#a6bbcf',
|
|
13
|
-
defaults: {
|
|
14
|
-
name: { value: '' },
|
|
15
|
-
action: { value: 'accept' },
|
|
16
|
-
sendText: { value: '' }
|
|
17
|
-
},
|
|
18
|
-
inputs: 1,
|
|
19
|
-
outputs: 1,
|
|
20
|
-
icon: 'white-globe.png',
|
|
21
|
-
label: function() {
|
|
22
|
-
return this.name || 'alert action'
|
|
23
|
-
},
|
|
24
|
-
oneditprepare: function() {
|
|
25
|
-
setAlertAction()
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<script type="text/x-red" data-template-name="alert-action">
|
|
31
|
-
|
|
32
|
-
<div class="form-row">
|
|
33
|
-
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
34
|
-
<select type="text" id="node-input-action" style="width:70%;" onchange="setAlertAction()">
|
|
35
|
-
<option value="dismiss">Dismiss Alert</option>
|
|
36
|
-
<option value="accept">Accept Alert</option>
|
|
37
|
-
<option value="getAlertText">Get Alert Text</option>
|
|
38
|
-
<option value="isPresent">Is Alert Present</option>
|
|
39
|
-
</select>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<div class="form-row" id="actionSendText">
|
|
44
|
-
<label for="node-input-sendText"><i class="fa fa-tasks"></i> Text to Send</label>
|
|
45
|
-
<input id="node-input-sendText" type="text">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div class="form-row">
|
|
50
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
51
|
-
<input id="node-input-name" type="text">
|
|
52
|
-
</div>
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<script type="text/x-red" data-help-name="alert-action">
|
|
58
|
-
<h3>Selected action of the node performs on pop-up alerts/windows.</h3>
|
|
59
|
-
<h3>Details</h3>
|
|
60
|
-
<dl class="message-properties">
|
|
61
|
-
<dt>Action: <span class="property-type">select</span></dt>
|
|
62
|
-
<dd>Action to perform on the pop-up alert/window:
|
|
63
|
-
<ul>
|
|
64
|
-
<li>Dismiss Alert</li>
|
|
65
|
-
<li>Accept Alert</li>
|
|
66
|
-
<li>Get Alert Text</li>
|
|
67
|
-
<li>Is Alert Present</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</dd>
|
|
70
|
-
</dl>
|
|
71
|
-
|
|
72
|
-
<h3>Outputs</h3>
|
|
73
|
-
<dl class="message-properties">
|
|
74
|
-
<dt>msg.payload: <span class="property-type">string/bool</span></dt>
|
|
75
|
-
<dd>If the <b>Get Alert Text</b> action is selected, the <code>ms.payload</code> will return the text on the alert message<br></dd>
|
|
76
|
-
<dd>If the <b>Is Alert Present</b> action is selected, <code>ms.payload</code> will return a true/false <code>boolean</code></dd>
|
|
77
|
-
</dl>
|
|
78
|
-
|
|
79
|
-
</script>
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
function setAlertAction() {
|
|
3
|
+
let action = $('#node-input-action').val()
|
|
4
|
+
$('#actionSendText').hide()
|
|
5
|
+
if (action === 'sendAlertText') {
|
|
6
|
+
$('#actionSendText').show()
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
RED.nodes.registerType('alert-action', {
|
|
11
|
+
category: 'Webdriver IO',
|
|
12
|
+
color: '#a6bbcf',
|
|
13
|
+
defaults: {
|
|
14
|
+
name: { value: '' },
|
|
15
|
+
action: { value: 'accept' },
|
|
16
|
+
sendText: { value: '' }
|
|
17
|
+
},
|
|
18
|
+
inputs: 1,
|
|
19
|
+
outputs: 1,
|
|
20
|
+
icon: 'white-globe.png',
|
|
21
|
+
label: function() {
|
|
22
|
+
return this.name || 'alert action'
|
|
23
|
+
},
|
|
24
|
+
oneditprepare: function() {
|
|
25
|
+
setAlertAction()
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<script type="text/x-red" data-template-name="alert-action">
|
|
31
|
+
|
|
32
|
+
<div class="form-row">
|
|
33
|
+
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
34
|
+
<select type="text" id="node-input-action" style="width:70%;" onchange="setAlertAction()">
|
|
35
|
+
<option value="dismiss">Dismiss Alert</option>
|
|
36
|
+
<option value="accept">Accept Alert</option>
|
|
37
|
+
<option value="getAlertText">Get Alert Text</option>
|
|
38
|
+
<option value="isPresent">Is Alert Present</option>
|
|
39
|
+
</select>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<div class="form-row" id="actionSendText">
|
|
44
|
+
<label for="node-input-sendText"><i class="fa fa-tasks"></i> Text to Send</label>
|
|
45
|
+
<input id="node-input-sendText" type="text">
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div class="form-row">
|
|
50
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
51
|
+
<input id="node-input-name" type="text">
|
|
52
|
+
</div>
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<script type="text/x-red" data-help-name="alert-action">
|
|
58
|
+
<h3>Selected action of the node performs on pop-up alerts/windows.</h3>
|
|
59
|
+
<h3>Details</h3>
|
|
60
|
+
<dl class="message-properties">
|
|
61
|
+
<dt>Action: <span class="property-type">select</span></dt>
|
|
62
|
+
<dd>Action to perform on the pop-up alert/window:
|
|
63
|
+
<ul>
|
|
64
|
+
<li>Dismiss Alert</li>
|
|
65
|
+
<li>Accept Alert</li>
|
|
66
|
+
<li>Get Alert Text</li>
|
|
67
|
+
<li>Is Alert Present</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</dd>
|
|
70
|
+
</dl>
|
|
71
|
+
|
|
72
|
+
<h3>Outputs</h3>
|
|
73
|
+
<dl class="message-properties">
|
|
74
|
+
<dt>msg.payload: <span class="property-type">string/bool</span></dt>
|
|
75
|
+
<dd>If the <b>Get Alert Text</b> action is selected, the <code>ms.payload</code> will return the text on the alert message<br></dd>
|
|
76
|
+
<dd>If the <b>Is Alert Present</b> action is selected, <code>ms.payload</code> will return a true/false <code>boolean</code></dd>
|
|
77
|
+
</dl>
|
|
78
|
+
|
|
79
|
+
</script>
|
package/src/alert-action.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
const common = require('./wdio-common')
|
|
2
|
-
|
|
3
|
-
const isAlertPresent = async (browser) => {
|
|
4
|
-
try {
|
|
5
|
-
await browser.getAlertText()
|
|
6
|
-
return true
|
|
7
|
-
} catch (e) {
|
|
8
|
-
return false
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = function(RED) {
|
|
13
|
-
function alertAction(config) {
|
|
14
|
-
RED.nodes.createNode(this, config)
|
|
15
|
-
const node = this
|
|
16
|
-
common.clearStatus(node)
|
|
17
|
-
|
|
18
|
-
node.on('input', async (msg) => {
|
|
19
|
-
try {
|
|
20
|
-
let browser = await common.getBrowser(node.context())
|
|
21
|
-
|
|
22
|
-
let value = msg.value || config.sendText
|
|
23
|
-
|
|
24
|
-
if (config.action === 'dismiss') {
|
|
25
|
-
node.log = 'Dismiss the alert.'
|
|
26
|
-
await browser.dismissAlert()
|
|
27
|
-
} else if (config.action === 'accept') {
|
|
28
|
-
node.log = 'Accept the alert displayed.'
|
|
29
|
-
await browser.acceptAlert()
|
|
30
|
-
} else if (config.action === 'getAlertText') {
|
|
31
|
-
node.log = 'Get the alert text.'
|
|
32
|
-
msg.payload = await browser.getAlertText()
|
|
33
|
-
} else if (config.action === 'sendAlertText') {
|
|
34
|
-
if (await isAlertPresent()) {
|
|
35
|
-
node.log = `Send "${value}" to alert.`
|
|
36
|
-
await browser.sendAlertText(value)
|
|
37
|
-
}
|
|
38
|
-
} else if (config.action === 'isPresent') {
|
|
39
|
-
node.log = 'Verify for an alert.'
|
|
40
|
-
msg.payload = await isAlertPresent(browser)
|
|
41
|
-
}
|
|
42
|
-
await common.log(node)
|
|
43
|
-
common.successStatus(node)
|
|
44
|
-
node.send(msg)
|
|
45
|
-
} catch (e) {
|
|
46
|
-
await common.log(node)
|
|
47
|
-
common.handleError(e, node, msg)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
RED.nodes.registerType('alert-action', alertAction)
|
|
52
|
-
}
|
|
1
|
+
const common = require('./wdio-common')
|
|
2
|
+
|
|
3
|
+
const isAlertPresent = async (browser) => {
|
|
4
|
+
try {
|
|
5
|
+
await browser.getAlertText()
|
|
6
|
+
return true
|
|
7
|
+
} catch (e) {
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = function(RED) {
|
|
13
|
+
function alertAction(config) {
|
|
14
|
+
RED.nodes.createNode(this, config)
|
|
15
|
+
const node = this
|
|
16
|
+
common.clearStatus(node)
|
|
17
|
+
|
|
18
|
+
node.on('input', async (msg) => {
|
|
19
|
+
try {
|
|
20
|
+
let browser = await common.getBrowser(node.context())
|
|
21
|
+
|
|
22
|
+
let value = msg.value || config.sendText
|
|
23
|
+
|
|
24
|
+
if (config.action === 'dismiss') {
|
|
25
|
+
node.log = 'Dismiss the alert.'
|
|
26
|
+
await browser.dismissAlert()
|
|
27
|
+
} else if (config.action === 'accept') {
|
|
28
|
+
node.log = 'Accept the alert displayed.'
|
|
29
|
+
await browser.acceptAlert()
|
|
30
|
+
} else if (config.action === 'getAlertText') {
|
|
31
|
+
node.log = 'Get the alert text.'
|
|
32
|
+
msg.payload = await browser.getAlertText()
|
|
33
|
+
} else if (config.action === 'sendAlertText') {
|
|
34
|
+
if (await isAlertPresent()) {
|
|
35
|
+
node.log = `Send "${value}" to alert.`
|
|
36
|
+
await browser.sendAlertText(value)
|
|
37
|
+
}
|
|
38
|
+
} else if (config.action === 'isPresent') {
|
|
39
|
+
node.log = 'Verify for an alert.'
|
|
40
|
+
msg.payload = await isAlertPresent(browser)
|
|
41
|
+
}
|
|
42
|
+
await common.log(node)
|
|
43
|
+
common.successStatus(node)
|
|
44
|
+
node.send(msg)
|
|
45
|
+
} catch (e) {
|
|
46
|
+
await common.log(node)
|
|
47
|
+
common.handleError(e, node, msg)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
RED.nodes.registerType('alert-action', alertAction)
|
|
52
|
+
}
|
package/src/browser-action.html
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
function setBrowserAction() {
|
|
3
|
-
let action = $('#node-input-action').val()
|
|
4
|
-
$('#actionURL').hide()
|
|
5
|
-
$('#actionWidth').hide()
|
|
6
|
-
$('#actionHeight').hide()
|
|
7
|
-
$('#actionValue').hide()
|
|
8
|
-
if (action === 'setSize') {
|
|
9
|
-
$('#actionWidth').show()
|
|
10
|
-
$('#actionHeight').show()
|
|
11
|
-
}
|
|
12
|
-
if (action === 'navigateTo') {
|
|
13
|
-
$('#actionURL').show()
|
|
14
|
-
}
|
|
15
|
-
if (action === 'keyStorkes') {
|
|
16
|
-
$('#actionValue').show()
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
RED.nodes.registerType('browser-action', {
|
|
21
|
-
category: 'Webdriver IO',
|
|
22
|
-
color: '#a6bbcf',
|
|
23
|
-
defaults: {
|
|
24
|
-
name: { value: '' },
|
|
25
|
-
action: { value: 'navigateTo' },
|
|
26
|
-
url: { value: '' },
|
|
27
|
-
width: { value: '' },
|
|
28
|
-
height: { value: '' },
|
|
29
|
-
keysArr: { value: '' }
|
|
30
|
-
},
|
|
31
|
-
inputs: 1,
|
|
32
|
-
outputs: 1,
|
|
33
|
-
icon: 'white-globe.png',
|
|
34
|
-
label: function() {
|
|
35
|
-
return this.name || 'browser action'
|
|
36
|
-
},
|
|
37
|
-
oneditprepare: function() {
|
|
38
|
-
setBrowserAction()
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<script type="text/x-red" data-template-name="browser-action">
|
|
44
|
-
<div class="form-row">
|
|
45
|
-
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
46
|
-
<select type="text" id="node-input-action" style="width:70%;" onchange="setBrowserAction()">
|
|
47
|
-
<option value="getUrl">Get URL</option>
|
|
48
|
-
<option value="navigateTo">Navigate To</option>
|
|
49
|
-
<option value="back">Back</option>
|
|
50
|
-
<option value="forward">Forward</option>
|
|
51
|
-
<option value="refresh">Refresh</option>
|
|
52
|
-
<option value="getTitle">Get Title</option>
|
|
53
|
-
<option value="setSize">Set window Size</option>
|
|
54
|
-
<option value="maximize">Maximize Window</option>
|
|
55
|
-
<option value="takeScreenShot">Screenshot</option>
|
|
56
|
-
<option value="pageSource">Get Page Source</option>
|
|
57
|
-
<option value="print">Print</option>
|
|
58
|
-
<option value="keyStrokes">Key Strokes</option>
|
|
59
|
-
<option value="getCookies">Get All Cookies</option>
|
|
60
|
-
</select>
|
|
61
|
-
</div>
|
|
62
|
-
<div class="form-row" id="actionURL">
|
|
63
|
-
<label for="node-input-url"><i class="fa fa-tasks"></i> URL</label>
|
|
64
|
-
<input id="node-input-url" type="text">
|
|
65
|
-
</div>
|
|
66
|
-
<div class="form-row" id="actionWidth">
|
|
67
|
-
<label for="node-input-width"><i class="fa fa-tasks"></i>Width</label>
|
|
68
|
-
<input id="node-input-width" type="text">
|
|
69
|
-
</div>
|
|
70
|
-
<div class="form-row" id="actionHeight">
|
|
71
|
-
<label for="node-input-height"><i class="fa fa-tasks"></i>Height</label>
|
|
72
|
-
<input id="node-input-height" type="text">
|
|
73
|
-
</div>
|
|
74
|
-
<div class="form-row" id="actionValue">
|
|
75
|
-
<label for="node-input-keysArr"><i class="fa fa-tasks"></i> Key Values</label>
|
|
76
|
-
<input id="node-input-keysArr" type="text">
|
|
77
|
-
</div>
|
|
78
|
-
<div class="form-row">
|
|
79
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
80
|
-
<input id="node-input-name" type="text">
|
|
81
|
-
</div>
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<script type="text/x-red" data-help-name="browser-action">
|
|
85
|
-
<h3>Performs from a list of standard browser actions on the current instance of the browser.</h3>
|
|
86
|
-
<h3>Inputs</h3>
|
|
87
|
-
<dl class="message-properties">
|
|
88
|
-
<dt>action: <span class="property-type">string</span></dt>
|
|
89
|
-
<dd>All the browser actions. Selected action will be performed on the browser.</dd>
|
|
90
|
-
<dt>url: <span class="property-type">string</span></dt>
|
|
91
|
-
<dd>Browser navigates to the provide url when we select the action as "navigateTo"</dd>
|
|
92
|
-
<dd>Can be parameterized using <code>msg.url</code>, by leaving the URL empty on node configuration.</dd>
|
|
93
|
-
<dt>width: <span class="property-type">string</span></dt>
|
|
94
|
-
<dd>Browser window will be adjusted to specified width.</dd>
|
|
95
|
-
<dd>Can be parameterized using <code>msg.width</code>, by leaving the Width empty on node configuration.</dd>
|
|
96
|
-
<dt>height: <span class="property-type">string</span></dt>
|
|
97
|
-
<dd>Browser window will be adjusted to specified height.</dd>
|
|
98
|
-
<dd>Can be parameterized using <code>msg.height</code>, by leaving the Height empty on node configuration.</dd>
|
|
99
|
-
<dt>Key Values: <span class="property-type">string</span></dt>
|
|
100
|
-
<dd>See the list of values as keys. click <a href="https://w3c.github.io/webdriver/#keyboard-actions">here</a>.</dd>
|
|
101
|
-
<dd>A string with , separated key values, which will be converted to an array of strings.</dd>
|
|
102
|
-
<dd>Can be parameterized using <code>msg.keysArr</code>, by leaving the Key Values empty on node configuration.</dd>
|
|
103
|
-
</dl>
|
|
104
|
-
|
|
105
|
-
<h3>Outputs</h3>
|
|
106
|
-
<dl class="message-properties">
|
|
107
|
-
<dt>msg.payload: <span class="property-type">string/Object</span></dt>
|
|
108
|
-
<dd><b>Get URL</b> returns url of the current browser tab<br></dd>
|
|
109
|
-
<dd><b>Get Title</b> returns title of the current browser tab<br></dd>
|
|
110
|
-
<dd><b>Screenshot</b> returns Base64 encode string value of screenshot of open window<br></dd>
|
|
111
|
-
<dd><b>Get Page Source</b> returns entire page source of the document<br></dd>
|
|
112
|
-
<dd><b>Get All Cookies</b> returns all cookies stored at the moment inside of an Object<br></dd>
|
|
113
|
-
</dl>
|
|
114
|
-
</script>
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
function setBrowserAction() {
|
|
3
|
+
let action = $('#node-input-action').val()
|
|
4
|
+
$('#actionURL').hide()
|
|
5
|
+
$('#actionWidth').hide()
|
|
6
|
+
$('#actionHeight').hide()
|
|
7
|
+
$('#actionValue').hide()
|
|
8
|
+
if (action === 'setSize') {
|
|
9
|
+
$('#actionWidth').show()
|
|
10
|
+
$('#actionHeight').show()
|
|
11
|
+
}
|
|
12
|
+
if (action === 'navigateTo') {
|
|
13
|
+
$('#actionURL').show()
|
|
14
|
+
}
|
|
15
|
+
if (action === 'keyStorkes') {
|
|
16
|
+
$('#actionValue').show()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
RED.nodes.registerType('browser-action', {
|
|
21
|
+
category: 'Webdriver IO',
|
|
22
|
+
color: '#a6bbcf',
|
|
23
|
+
defaults: {
|
|
24
|
+
name: { value: '' },
|
|
25
|
+
action: { value: 'navigateTo' },
|
|
26
|
+
url: { value: '' },
|
|
27
|
+
width: { value: '' },
|
|
28
|
+
height: { value: '' },
|
|
29
|
+
keysArr: { value: '' }
|
|
30
|
+
},
|
|
31
|
+
inputs: 1,
|
|
32
|
+
outputs: 1,
|
|
33
|
+
icon: 'white-globe.png',
|
|
34
|
+
label: function() {
|
|
35
|
+
return this.name || 'browser action'
|
|
36
|
+
},
|
|
37
|
+
oneditprepare: function() {
|
|
38
|
+
setBrowserAction()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<script type="text/x-red" data-template-name="browser-action">
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
46
|
+
<select type="text" id="node-input-action" style="width:70%;" onchange="setBrowserAction()">
|
|
47
|
+
<option value="getUrl">Get URL</option>
|
|
48
|
+
<option value="navigateTo">Navigate To</option>
|
|
49
|
+
<option value="back">Back</option>
|
|
50
|
+
<option value="forward">Forward</option>
|
|
51
|
+
<option value="refresh">Refresh</option>
|
|
52
|
+
<option value="getTitle">Get Title</option>
|
|
53
|
+
<option value="setSize">Set window Size</option>
|
|
54
|
+
<option value="maximize">Maximize Window</option>
|
|
55
|
+
<option value="takeScreenShot">Screenshot</option>
|
|
56
|
+
<option value="pageSource">Get Page Source</option>
|
|
57
|
+
<option value="print">Print</option>
|
|
58
|
+
<option value="keyStrokes">Key Strokes</option>
|
|
59
|
+
<option value="getCookies">Get All Cookies</option>
|
|
60
|
+
</select>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="form-row" id="actionURL">
|
|
63
|
+
<label for="node-input-url"><i class="fa fa-tasks"></i> URL</label>
|
|
64
|
+
<input id="node-input-url" type="text">
|
|
65
|
+
</div>
|
|
66
|
+
<div class="form-row" id="actionWidth">
|
|
67
|
+
<label for="node-input-width"><i class="fa fa-tasks"></i>Width</label>
|
|
68
|
+
<input id="node-input-width" type="text">
|
|
69
|
+
</div>
|
|
70
|
+
<div class="form-row" id="actionHeight">
|
|
71
|
+
<label for="node-input-height"><i class="fa fa-tasks"></i>Height</label>
|
|
72
|
+
<input id="node-input-height" type="text">
|
|
73
|
+
</div>
|
|
74
|
+
<div class="form-row" id="actionValue">
|
|
75
|
+
<label for="node-input-keysArr"><i class="fa fa-tasks"></i> Key Values</label>
|
|
76
|
+
<input id="node-input-keysArr" type="text">
|
|
77
|
+
</div>
|
|
78
|
+
<div class="form-row">
|
|
79
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
80
|
+
<input id="node-input-name" type="text">
|
|
81
|
+
</div>
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<script type="text/x-red" data-help-name="browser-action">
|
|
85
|
+
<h3>Performs from a list of standard browser actions on the current instance of the browser.</h3>
|
|
86
|
+
<h3>Inputs</h3>
|
|
87
|
+
<dl class="message-properties">
|
|
88
|
+
<dt>action: <span class="property-type">string</span></dt>
|
|
89
|
+
<dd>All the browser actions. Selected action will be performed on the browser.</dd>
|
|
90
|
+
<dt>url: <span class="property-type">string</span></dt>
|
|
91
|
+
<dd>Browser navigates to the provide url when we select the action as "navigateTo"</dd>
|
|
92
|
+
<dd>Can be parameterized using <code>msg.url</code>, by leaving the URL empty on node configuration.</dd>
|
|
93
|
+
<dt>width: <span class="property-type">string</span></dt>
|
|
94
|
+
<dd>Browser window will be adjusted to specified width.</dd>
|
|
95
|
+
<dd>Can be parameterized using <code>msg.width</code>, by leaving the Width empty on node configuration.</dd>
|
|
96
|
+
<dt>height: <span class="property-type">string</span></dt>
|
|
97
|
+
<dd>Browser window will be adjusted to specified height.</dd>
|
|
98
|
+
<dd>Can be parameterized using <code>msg.height</code>, by leaving the Height empty on node configuration.</dd>
|
|
99
|
+
<dt>Key Values: <span class="property-type">string</span></dt>
|
|
100
|
+
<dd>See the list of values as keys. click <a href="https://w3c.github.io/webdriver/#keyboard-actions">here</a>.</dd>
|
|
101
|
+
<dd>A string with , separated key values, which will be converted to an array of strings.</dd>
|
|
102
|
+
<dd>Can be parameterized using <code>msg.keysArr</code>, by leaving the Key Values empty on node configuration.</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
<h3>Outputs</h3>
|
|
106
|
+
<dl class="message-properties">
|
|
107
|
+
<dt>msg.payload: <span class="property-type">string/Object</span></dt>
|
|
108
|
+
<dd><b>Get URL</b> returns url of the current browser tab<br></dd>
|
|
109
|
+
<dd><b>Get Title</b> returns title of the current browser tab<br></dd>
|
|
110
|
+
<dd><b>Screenshot</b> returns Base64 encode string value of screenshot of open window<br></dd>
|
|
111
|
+
<dd><b>Get Page Source</b> returns entire page source of the document<br></dd>
|
|
112
|
+
<dd><b>Get All Cookies</b> returns all cookies stored at the moment inside of an Object<br></dd>
|
|
113
|
+
</dl>
|
|
114
|
+
</script>
|