topological-nodered-wdio 0.5.4 → 1.0.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 -44
- package/src/alert-action.html +79 -79
- package/src/alert-action.js +52 -52
- package/src/browser-action.html +128 -114
- package/src/browser-action.js +85 -70
- package/src/delete-session.html +26 -26
- package/src/delete-session.js +29 -29
- package/src/document-helper.html +59 -59
- package/src/document-helper.js +23 -23
- 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 +108 -108
- package/src/wdio-common.js +163 -163
- package/src/window-action.html +91 -91
- package/src/window-action.js +43 -43
package/src/dropdown-action.html
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
function setDropdownAction() {
|
|
3
|
-
let action = $('#node-input-action').val()
|
|
4
|
-
$('#actionText').hide()
|
|
5
|
-
$('#actionAttr').hide()
|
|
6
|
-
$('#actionIndex').hide()
|
|
7
|
-
$('#actionValue').hide()
|
|
8
|
-
if (action == 'selectByAttr') {
|
|
9
|
-
$('#actionAttr').show()
|
|
10
|
-
$('#actionValue').show()
|
|
11
|
-
}
|
|
12
|
-
if (action == 'selectByIndex') {
|
|
13
|
-
$('#actionIndex').show()
|
|
14
|
-
}
|
|
15
|
-
if (action == 'selectByText') {
|
|
16
|
-
$('#actionText').show()
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
RED.nodes.registerType('dropdown-action', {
|
|
21
|
-
category: 'Webdriver IO',
|
|
22
|
-
color: '#a6bbcf',
|
|
23
|
-
defaults: {
|
|
24
|
-
name: { value: '' },
|
|
25
|
-
locateUsing: { value: 'xpath' },
|
|
26
|
-
locateValue: { value: '' },
|
|
27
|
-
action: { value: 'selectByAttr' },
|
|
28
|
-
text: { value: '' },
|
|
29
|
-
attribute: { value: '' },
|
|
30
|
-
index: { value: '' },
|
|
31
|
-
value: { value: '' }
|
|
32
|
-
},
|
|
33
|
-
inputs: 1,
|
|
34
|
-
outputs: 1,
|
|
35
|
-
icon: 'white-globe.png',
|
|
36
|
-
label: function () {
|
|
37
|
-
return this.name || 'dropdown action'
|
|
38
|
-
},
|
|
39
|
-
oneditprepare: function () {
|
|
40
|
-
setDropdownAction()
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<script type="text/x-red" data-template-name="dropdown-action">
|
|
46
|
-
<div class="form-row">
|
|
47
|
-
<label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
|
|
48
|
-
<select type="text" id="node-input-locateUsing" style="width:70%;">
|
|
49
|
-
<option value="id">id</option>
|
|
50
|
-
<option value="name">name</option>
|
|
51
|
-
<option value="className">Class Name</option>
|
|
52
|
-
<option value="css selector">CSS selector</option>
|
|
53
|
-
<option value="link text">Link text</option>
|
|
54
|
-
<option value="partial link text">Partial link text</option>
|
|
55
|
-
<option value="tag name">Tag name</option>
|
|
56
|
-
<option value="xpath" selected>XPath</option>
|
|
57
|
-
</select>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="form-row">
|
|
60
|
-
<label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
|
|
61
|
-
<input id="node-input-locateValue" type="text">
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="form-row">
|
|
65
|
-
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
66
|
-
<select type="text" id="node-input-action" style="width:70%;" onchange="setDropdownAction()">
|
|
67
|
-
<option value="selectByAttr">Select by Attribute</option>
|
|
68
|
-
<option value="selectByIndex">Select by Index</option>
|
|
69
|
-
<option value="selectByText">Select by Visual text</option>
|
|
70
|
-
<option value="getValue">Get Value</option>
|
|
71
|
-
</select>
|
|
72
|
-
</div>
|
|
73
|
-
<div class="form-row" id="actionText">
|
|
74
|
-
<label for="node-input-text"><i class="fa fa-tasks"></i> Text to Select</label>
|
|
75
|
-
<input id="node-input-text" type="text">
|
|
76
|
-
</div>
|
|
77
|
-
<div class="form-row" id="actionAttr">
|
|
78
|
-
<label for="node-input-attribute"><i class="fa fa-tasks"></i> Attribute Name</label>
|
|
79
|
-
<input id="node-input-attribute" type="text">
|
|
80
|
-
</div>
|
|
81
|
-
<div class="form-row" id="actionValue">
|
|
82
|
-
<label for="node-input-value"><i class="fa fa-tasks"></i> Value</label>
|
|
83
|
-
<input id="node-input-value" type="text">
|
|
84
|
-
</div>
|
|
85
|
-
<div class="form-row" id="actionIndex">
|
|
86
|
-
<label for="node-input-index"><i class="fa fa-tasks"></i> Index</label>
|
|
87
|
-
<input id="node-input-index" type="text">
|
|
88
|
-
</div>
|
|
89
|
-
<div class="form-row">
|
|
90
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
91
|
-
<input id="node-input-name" type="text">
|
|
92
|
-
</div>
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
|
-
<script type="text/x-red" data-help-name="dropdown-action">
|
|
96
|
-
<h3>Perform action on a dropdown selector</h3>
|
|
97
|
-
<h3>Inputs</h3>
|
|
98
|
-
<dl class="message-properties">
|
|
99
|
-
|
|
100
|
-
<dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
|
|
101
|
-
<dd>specifies the type of web element identifier:
|
|
102
|
-
<ul>
|
|
103
|
-
<li>id</li>
|
|
104
|
-
<li>name</li>
|
|
105
|
-
<li>Class Name</li>
|
|
106
|
-
<li>Jquery selector</li>
|
|
107
|
-
</ul>
|
|
108
|
-
<br>
|
|
109
|
-
</dd>
|
|
110
|
-
<dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
|
|
111
|
-
<dd>value passed to the web element identifier (Locate Method)<br></dd>
|
|
112
|
-
</dl>
|
|
113
|
-
|
|
114
|
-
<h3>Details</h3>
|
|
115
|
-
<p><b>Locate Method</b> specifies the method used to target the web element/dropdown. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
|
|
116
|
-
<p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
|
|
117
|
-
<p><b>Action</b> specifies the action to be performed on the target dropdown. Actions includes:
|
|
118
|
-
<ul>
|
|
119
|
-
<li>Select By Attribute</li>
|
|
120
|
-
<li>Select By Index</li>
|
|
121
|
-
<li>Select by Visual text</li>
|
|
122
|
-
<li>Get Value</li>
|
|
123
|
-
</ul>
|
|
124
|
-
</p>
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
function setDropdownAction() {
|
|
3
|
+
let action = $('#node-input-action').val()
|
|
4
|
+
$('#actionText').hide()
|
|
5
|
+
$('#actionAttr').hide()
|
|
6
|
+
$('#actionIndex').hide()
|
|
7
|
+
$('#actionValue').hide()
|
|
8
|
+
if (action == 'selectByAttr') {
|
|
9
|
+
$('#actionAttr').show()
|
|
10
|
+
$('#actionValue').show()
|
|
11
|
+
}
|
|
12
|
+
if (action == 'selectByIndex') {
|
|
13
|
+
$('#actionIndex').show()
|
|
14
|
+
}
|
|
15
|
+
if (action == 'selectByText') {
|
|
16
|
+
$('#actionText').show()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
RED.nodes.registerType('dropdown-action', {
|
|
21
|
+
category: 'Webdriver IO',
|
|
22
|
+
color: '#a6bbcf',
|
|
23
|
+
defaults: {
|
|
24
|
+
name: { value: '' },
|
|
25
|
+
locateUsing: { value: 'xpath' },
|
|
26
|
+
locateValue: { value: '' },
|
|
27
|
+
action: { value: 'selectByAttr' },
|
|
28
|
+
text: { value: '' },
|
|
29
|
+
attribute: { value: '' },
|
|
30
|
+
index: { value: '' },
|
|
31
|
+
value: { value: '' }
|
|
32
|
+
},
|
|
33
|
+
inputs: 1,
|
|
34
|
+
outputs: 1,
|
|
35
|
+
icon: 'white-globe.png',
|
|
36
|
+
label: function () {
|
|
37
|
+
return this.name || 'dropdown action'
|
|
38
|
+
},
|
|
39
|
+
oneditprepare: function () {
|
|
40
|
+
setDropdownAction()
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<script type="text/x-red" data-template-name="dropdown-action">
|
|
46
|
+
<div class="form-row">
|
|
47
|
+
<label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
|
|
48
|
+
<select type="text" id="node-input-locateUsing" style="width:70%;">
|
|
49
|
+
<option value="id">id</option>
|
|
50
|
+
<option value="name">name</option>
|
|
51
|
+
<option value="className">Class Name</option>
|
|
52
|
+
<option value="css selector">CSS selector</option>
|
|
53
|
+
<option value="link text">Link text</option>
|
|
54
|
+
<option value="partial link text">Partial link text</option>
|
|
55
|
+
<option value="tag name">Tag name</option>
|
|
56
|
+
<option value="xpath" selected>XPath</option>
|
|
57
|
+
</select>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="form-row">
|
|
60
|
+
<label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
|
|
61
|
+
<input id="node-input-locateValue" type="text">
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="form-row">
|
|
65
|
+
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
66
|
+
<select type="text" id="node-input-action" style="width:70%;" onchange="setDropdownAction()">
|
|
67
|
+
<option value="selectByAttr">Select by Attribute</option>
|
|
68
|
+
<option value="selectByIndex">Select by Index</option>
|
|
69
|
+
<option value="selectByText">Select by Visual text</option>
|
|
70
|
+
<option value="getValue">Get Value</option>
|
|
71
|
+
</select>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="form-row" id="actionText">
|
|
74
|
+
<label for="node-input-text"><i class="fa fa-tasks"></i> Text to Select</label>
|
|
75
|
+
<input id="node-input-text" type="text">
|
|
76
|
+
</div>
|
|
77
|
+
<div class="form-row" id="actionAttr">
|
|
78
|
+
<label for="node-input-attribute"><i class="fa fa-tasks"></i> Attribute Name</label>
|
|
79
|
+
<input id="node-input-attribute" type="text">
|
|
80
|
+
</div>
|
|
81
|
+
<div class="form-row" id="actionValue">
|
|
82
|
+
<label for="node-input-value"><i class="fa fa-tasks"></i> Value</label>
|
|
83
|
+
<input id="node-input-value" type="text">
|
|
84
|
+
</div>
|
|
85
|
+
<div class="form-row" id="actionIndex">
|
|
86
|
+
<label for="node-input-index"><i class="fa fa-tasks"></i> Index</label>
|
|
87
|
+
<input id="node-input-index" type="text">
|
|
88
|
+
</div>
|
|
89
|
+
<div class="form-row">
|
|
90
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
91
|
+
<input id="node-input-name" type="text">
|
|
92
|
+
</div>
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<script type="text/x-red" data-help-name="dropdown-action">
|
|
96
|
+
<h3>Perform action on a dropdown selector</h3>
|
|
97
|
+
<h3>Inputs</h3>
|
|
98
|
+
<dl class="message-properties">
|
|
99
|
+
|
|
100
|
+
<dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
|
|
101
|
+
<dd>specifies the type of web element identifier:
|
|
102
|
+
<ul>
|
|
103
|
+
<li>id</li>
|
|
104
|
+
<li>name</li>
|
|
105
|
+
<li>Class Name</li>
|
|
106
|
+
<li>Jquery selector</li>
|
|
107
|
+
</ul>
|
|
108
|
+
<br>
|
|
109
|
+
</dd>
|
|
110
|
+
<dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
|
|
111
|
+
<dd>value passed to the web element identifier (Locate Method)<br></dd>
|
|
112
|
+
</dl>
|
|
113
|
+
|
|
114
|
+
<h3>Details</h3>
|
|
115
|
+
<p><b>Locate Method</b> specifies the method used to target the web element/dropdown. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
|
|
116
|
+
<p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
|
|
117
|
+
<p><b>Action</b> specifies the action to be performed on the target dropdown. Actions includes:
|
|
118
|
+
<ul>
|
|
119
|
+
<li>Select By Attribute</li>
|
|
120
|
+
<li>Select By Index</li>
|
|
121
|
+
<li>Select by Visual text</li>
|
|
122
|
+
<li>Get Value</li>
|
|
123
|
+
</ul>
|
|
124
|
+
</p>
|
|
125
125
|
</script>
|
package/src/dropdown-action.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
const common = require('./wdio-common')
|
|
2
|
-
|
|
3
|
-
module.exports = function(RED) {
|
|
4
|
-
function dropdownAction(config) {
|
|
5
|
-
RED.nodes.createNode(this, config)
|
|
6
|
-
const node = this
|
|
7
|
-
common.clearStatus(node)
|
|
8
|
-
|
|
9
|
-
node.on('input', async (msg) => {
|
|
10
|
-
try {
|
|
11
|
-
let locateUsing = config.locateUsing || msg.locateUsing
|
|
12
|
-
let locateValue = config.locateValue || msg.locateValue
|
|
13
|
-
|
|
14
|
-
let browser = await common.getBrowser(node.context())
|
|
15
|
-
let locator = await common.getLocator(
|
|
16
|
-
browser,
|
|
17
|
-
locateUsing,
|
|
18
|
-
locateValue
|
|
19
|
-
)
|
|
20
|
-
let element = await browser.$(locator)
|
|
21
|
-
|
|
22
|
-
let text = config.text || msg.text
|
|
23
|
-
let attribute = config.attribute || msg.attribute
|
|
24
|
-
let index = config.index || msg.index
|
|
25
|
-
let value = config.value || msg.value
|
|
26
|
-
|
|
27
|
-
if (config.action === 'selectByAttr') {
|
|
28
|
-
node.log = `Select the dropdown value using Attribute: ${attribute} with Value: ${value}.`
|
|
29
|
-
await element.selectByAttribute(attribute, value)
|
|
30
|
-
} else if (config.action === 'selectByIndex') {
|
|
31
|
-
node.log = `Select the dropdown value using Index: ${index}.`
|
|
32
|
-
await element.selectByIndex(parseInt(index))
|
|
33
|
-
} else if (config.action === 'selectByText') {
|
|
34
|
-
node.log = `Select the dropdown value using Visible text: ${text}.`
|
|
35
|
-
await element.selectByVisibleText(text)
|
|
36
|
-
} else if (config.action === 'getValue') {
|
|
37
|
-
node.log = 'Get selected drop down value.'
|
|
38
|
-
msg.payload = await element.getValue()
|
|
39
|
-
}
|
|
40
|
-
await common.log(node)
|
|
41
|
-
common.successStatus(node)
|
|
42
|
-
node.send(msg)
|
|
43
|
-
} catch (e) {
|
|
44
|
-
await common.log(node)
|
|
45
|
-
common.handleError(e, node, msg)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
RED.nodes.registerType('dropdown-action', dropdownAction)
|
|
50
|
-
}
|
|
1
|
+
const common = require('./wdio-common')
|
|
2
|
+
|
|
3
|
+
module.exports = function(RED) {
|
|
4
|
+
function dropdownAction(config) {
|
|
5
|
+
RED.nodes.createNode(this, config)
|
|
6
|
+
const node = this
|
|
7
|
+
common.clearStatus(node)
|
|
8
|
+
|
|
9
|
+
node.on('input', async (msg) => {
|
|
10
|
+
try {
|
|
11
|
+
let locateUsing = config.locateUsing || msg.locateUsing
|
|
12
|
+
let locateValue = config.locateValue || msg.locateValue
|
|
13
|
+
|
|
14
|
+
let browser = await common.getBrowser(node.context())
|
|
15
|
+
let locator = await common.getLocator(
|
|
16
|
+
browser,
|
|
17
|
+
locateUsing,
|
|
18
|
+
locateValue
|
|
19
|
+
)
|
|
20
|
+
let element = await browser.$(locator)
|
|
21
|
+
|
|
22
|
+
let text = config.text || msg.text
|
|
23
|
+
let attribute = config.attribute || msg.attribute
|
|
24
|
+
let index = config.index || msg.index
|
|
25
|
+
let value = config.value || msg.value
|
|
26
|
+
|
|
27
|
+
if (config.action === 'selectByAttr') {
|
|
28
|
+
node.log = `Select the dropdown value using Attribute: ${attribute} with Value: ${value}.`
|
|
29
|
+
await element.selectByAttribute(attribute, value)
|
|
30
|
+
} else if (config.action === 'selectByIndex') {
|
|
31
|
+
node.log = `Select the dropdown value using Index: ${index}.`
|
|
32
|
+
await element.selectByIndex(parseInt(index))
|
|
33
|
+
} else if (config.action === 'selectByText') {
|
|
34
|
+
node.log = `Select the dropdown value using Visible text: ${text}.`
|
|
35
|
+
await element.selectByVisibleText(text)
|
|
36
|
+
} else if (config.action === 'getValue') {
|
|
37
|
+
node.log = 'Get selected drop down value.'
|
|
38
|
+
msg.payload = await element.getValue()
|
|
39
|
+
}
|
|
40
|
+
await common.log(node)
|
|
41
|
+
common.successStatus(node)
|
|
42
|
+
node.send(msg)
|
|
43
|
+
} catch (e) {
|
|
44
|
+
await common.log(node)
|
|
45
|
+
common.handleError(e, node, msg)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
RED.nodes.registerType('dropdown-action', dropdownAction)
|
|
50
|
+
}
|
package/src/element-action.html
CHANGED
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
function setAction() {
|
|
3
|
-
let action = $('#node-input-action').val()
|
|
4
|
-
$('#actionSendKeys').hide()
|
|
5
|
-
$('#getAttribute').hide()
|
|
6
|
-
if (action == 'sendKeys') {
|
|
7
|
-
$('#actionSendKeys').show()
|
|
8
|
-
}
|
|
9
|
-
if (action == 'getAttribute') {
|
|
10
|
-
$('#getAttribute').show()
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
RED.nodes.registerType('element-action', {
|
|
15
|
-
category: 'Webdriver IO',
|
|
16
|
-
color: '#a6bbcf',
|
|
17
|
-
defaults: {
|
|
18
|
-
name: { value: '' },
|
|
19
|
-
locateUsing: { value: 'xpath' },
|
|
20
|
-
locateValue: { value: '' },
|
|
21
|
-
action: { value: 'click' },
|
|
22
|
-
sendKeys: {
|
|
23
|
-
value: '',
|
|
24
|
-
validate: RED.validators.typedInput('object')
|
|
25
|
-
},
|
|
26
|
-
object: { value: '' },
|
|
27
|
-
attribute: { value: '' }
|
|
28
|
-
},
|
|
29
|
-
inputs: 1,
|
|
30
|
-
outputs: 1,
|
|
31
|
-
icon: 'white-globe.png',
|
|
32
|
-
label: function() {
|
|
33
|
-
return this.name || 'element action'
|
|
34
|
-
},
|
|
35
|
-
oneditprepare: function() {
|
|
36
|
-
setAction()
|
|
37
|
-
$('#node-input-sendKeys').typedInput({
|
|
38
|
-
default: 'str',
|
|
39
|
-
typeField: $('#node-input-object'),
|
|
40
|
-
types: ['msg', 'flow', 'global', 'str']
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<script type="text/x-red" data-template-name="element-action">
|
|
47
|
-
<div class="form-row">
|
|
48
|
-
<label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
|
|
49
|
-
<select type="text" id="node-input-locateUsing" style="width:70%;">
|
|
50
|
-
<option value="id">id</option>
|
|
51
|
-
<option value="name">name</option>
|
|
52
|
-
<option value="css selector">CSS selector</option>
|
|
53
|
-
<option value="link text">Link text</option>
|
|
54
|
-
<option value="partial link text">Partial link text</option>
|
|
55
|
-
<option value="tag name">Tag name</option>
|
|
56
|
-
<option value="xpath" selected>XPath</option>
|
|
57
|
-
</select>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="form-row">
|
|
60
|
-
<label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
|
|
61
|
-
<input id="node-input-locateValue" type="text">
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="form-row">
|
|
65
|
-
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
66
|
-
<select type="text" id="node-input-action" style="width:70%;" onchange="setAction()">
|
|
67
|
-
<option value="click">Click</option>
|
|
68
|
-
<option value="clear">Clear</option>
|
|
69
|
-
<option value="sendKeys">Send Keys</option>
|
|
70
|
-
<option value="getValue">Get Value</option>
|
|
71
|
-
<option value="getText">Get Text</option>
|
|
72
|
-
<option value="getAttribute">Get Attribute</option>
|
|
73
|
-
<option value="takeScreenShot">Element Screenshot</option>
|
|
74
|
-
<option value="hover">Hover</option>
|
|
75
|
-
</select>
|
|
76
|
-
</div>
|
|
77
|
-
<div class="form-row" id="actionSendKeys">
|
|
78
|
-
<label for="node-input-sendKeys"><i class="fa fa-tasks"></i> Text to Send</label>
|
|
79
|
-
<input type="text" id="node-input-sendKeys" style="width:70%">
|
|
80
|
-
<input type="hidden" id="node-input-object">
|
|
81
|
-
</div>
|
|
82
|
-
<div class="form-row" id="getAttribute">
|
|
83
|
-
<label for="node-input-attribute"><i class="fa fa-tasks"></i>Attribute Name</label>
|
|
84
|
-
<input id="node-input-attribute" type="text">
|
|
85
|
-
</div>
|
|
86
|
-
<div class="form-row">
|
|
87
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
88
|
-
<input id="node-input-name" type="text">
|
|
89
|
-
</div>
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<script type="text/x-red" data-help-name="element-action">
|
|
93
|
-
<h3>Perform a list of actions on a target web element.</h3>
|
|
94
|
-
<h3>Inputs</h3>
|
|
95
|
-
<dl class="message-properties">
|
|
96
|
-
|
|
97
|
-
<dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
|
|
98
|
-
<dd>specifies the type of web element identifier:
|
|
99
|
-
<ul>
|
|
100
|
-
<li>id</li>
|
|
101
|
-
<li>name</li>
|
|
102
|
-
<li>CSS selector</li>
|
|
103
|
-
<li>Link text</li>
|
|
104
|
-
<li>Partial link text</li>
|
|
105
|
-
<li>Tag name</li>
|
|
106
|
-
<li>XPath</li>
|
|
107
|
-
</ul>
|
|
108
|
-
<br>
|
|
109
|
-
</dd>
|
|
110
|
-
<dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
|
|
111
|
-
<dd>value passed to the web element identifier (Locate Method)<br></dd>
|
|
112
|
-
|
|
113
|
-
<dt><code>msg.value</code><span class="property-type">string</span></dt>
|
|
114
|
-
<dd>If you elect to SendKeys to the web element, this is the value that would be sent</dd>
|
|
115
|
-
</dl>
|
|
116
|
-
|
|
117
|
-
<h3>Details</h3>
|
|
118
|
-
<p><b>Locate Method</b> specifies the method used to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
|
|
119
|
-
<p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
|
|
120
|
-
<p><b>Action</b> specifies the action to be performed on the target web element. Actions includes:
|
|
121
|
-
<ul>
|
|
122
|
-
<li>Click</li>
|
|
123
|
-
<li>Clear</li>
|
|
124
|
-
<li>Send Keys</li>
|
|
125
|
-
<li>Get Value</li>
|
|
126
|
-
<li>Get Text</li>
|
|
127
|
-
<li>Get Attribute</li>
|
|
128
|
-
<li>Element Screenshot</li>
|
|
129
|
-
<li>Hover</li>
|
|
130
|
-
</ul>
|
|
131
|
-
</p>
|
|
132
|
-
<p><b>Text to Send</b> if the Send Keys action is selected, this value would send the text to the selected web element.<br></p>
|
|
133
|
-
</script>
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
function setAction() {
|
|
3
|
+
let action = $('#node-input-action').val()
|
|
4
|
+
$('#actionSendKeys').hide()
|
|
5
|
+
$('#getAttribute').hide()
|
|
6
|
+
if (action == 'sendKeys') {
|
|
7
|
+
$('#actionSendKeys').show()
|
|
8
|
+
}
|
|
9
|
+
if (action == 'getAttribute') {
|
|
10
|
+
$('#getAttribute').show()
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
RED.nodes.registerType('element-action', {
|
|
15
|
+
category: 'Webdriver IO',
|
|
16
|
+
color: '#a6bbcf',
|
|
17
|
+
defaults: {
|
|
18
|
+
name: { value: '' },
|
|
19
|
+
locateUsing: { value: 'xpath' },
|
|
20
|
+
locateValue: { value: '' },
|
|
21
|
+
action: { value: 'click' },
|
|
22
|
+
sendKeys: {
|
|
23
|
+
value: '',
|
|
24
|
+
validate: RED.validators.typedInput('object')
|
|
25
|
+
},
|
|
26
|
+
object: { value: '' },
|
|
27
|
+
attribute: { value: '' }
|
|
28
|
+
},
|
|
29
|
+
inputs: 1,
|
|
30
|
+
outputs: 1,
|
|
31
|
+
icon: 'white-globe.png',
|
|
32
|
+
label: function() {
|
|
33
|
+
return this.name || 'element action'
|
|
34
|
+
},
|
|
35
|
+
oneditprepare: function() {
|
|
36
|
+
setAction()
|
|
37
|
+
$('#node-input-sendKeys').typedInput({
|
|
38
|
+
default: 'str',
|
|
39
|
+
typeField: $('#node-input-object'),
|
|
40
|
+
types: ['msg', 'flow', 'global', 'str']
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<script type="text/x-red" data-template-name="element-action">
|
|
47
|
+
<div class="form-row">
|
|
48
|
+
<label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
|
|
49
|
+
<select type="text" id="node-input-locateUsing" style="width:70%;">
|
|
50
|
+
<option value="id">id</option>
|
|
51
|
+
<option value="name">name</option>
|
|
52
|
+
<option value="css selector">CSS selector</option>
|
|
53
|
+
<option value="link text">Link text</option>
|
|
54
|
+
<option value="partial link text">Partial link text</option>
|
|
55
|
+
<option value="tag name">Tag name</option>
|
|
56
|
+
<option value="xpath" selected>XPath</option>
|
|
57
|
+
</select>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="form-row">
|
|
60
|
+
<label for="node-input-locateValue"><i class="fa fa-tasks"></i> Selector</label>
|
|
61
|
+
<input id="node-input-locateValue" type="text">
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div class="form-row">
|
|
65
|
+
<label for="node-input-action"><i class="fa fa-tasks"></i> Action</label>
|
|
66
|
+
<select type="text" id="node-input-action" style="width:70%;" onchange="setAction()">
|
|
67
|
+
<option value="click">Click</option>
|
|
68
|
+
<option value="clear">Clear</option>
|
|
69
|
+
<option value="sendKeys">Send Keys</option>
|
|
70
|
+
<option value="getValue">Get Value</option>
|
|
71
|
+
<option value="getText">Get Text</option>
|
|
72
|
+
<option value="getAttribute">Get Attribute</option>
|
|
73
|
+
<option value="takeScreenShot">Element Screenshot</option>
|
|
74
|
+
<option value="hover">Hover</option>
|
|
75
|
+
</select>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="form-row" id="actionSendKeys">
|
|
78
|
+
<label for="node-input-sendKeys"><i class="fa fa-tasks"></i> Text to Send</label>
|
|
79
|
+
<input type="text" id="node-input-sendKeys" style="width:70%">
|
|
80
|
+
<input type="hidden" id="node-input-object">
|
|
81
|
+
</div>
|
|
82
|
+
<div class="form-row" id="getAttribute">
|
|
83
|
+
<label for="node-input-attribute"><i class="fa fa-tasks"></i>Attribute Name</label>
|
|
84
|
+
<input id="node-input-attribute" type="text">
|
|
85
|
+
</div>
|
|
86
|
+
<div class="form-row">
|
|
87
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
88
|
+
<input id="node-input-name" type="text">
|
|
89
|
+
</div>
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<script type="text/x-red" data-help-name="element-action">
|
|
93
|
+
<h3>Perform a list of actions on a target web element.</h3>
|
|
94
|
+
<h3>Inputs</h3>
|
|
95
|
+
<dl class="message-properties">
|
|
96
|
+
|
|
97
|
+
<dt><code>mgs.locateUsing</code>: <span class="property-type">string</span></dt>
|
|
98
|
+
<dd>specifies the type of web element identifier:
|
|
99
|
+
<ul>
|
|
100
|
+
<li>id</li>
|
|
101
|
+
<li>name</li>
|
|
102
|
+
<li>CSS selector</li>
|
|
103
|
+
<li>Link text</li>
|
|
104
|
+
<li>Partial link text</li>
|
|
105
|
+
<li>Tag name</li>
|
|
106
|
+
<li>XPath</li>
|
|
107
|
+
</ul>
|
|
108
|
+
<br>
|
|
109
|
+
</dd>
|
|
110
|
+
<dt><code>msg.locateValue</code><span class="property-type">string</span></dt>
|
|
111
|
+
<dd>value passed to the web element identifier (Locate Method)<br></dd>
|
|
112
|
+
|
|
113
|
+
<dt><code>msg.value</code><span class="property-type">string</span></dt>
|
|
114
|
+
<dd>If you elect to SendKeys to the web element, this is the value that would be sent</dd>
|
|
115
|
+
</dl>
|
|
116
|
+
|
|
117
|
+
<h3>Details</h3>
|
|
118
|
+
<p><b>Locate Method</b> specifies the method used to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateUsing</code><br></p>
|
|
119
|
+
<p><b>Selector</b> value used by the Locate Method to target the web element. This option can be selected manually from the Properties panel OR it can be received from <code>mgs.locateValue</code><br></p>
|
|
120
|
+
<p><b>Action</b> specifies the action to be performed on the target web element. Actions includes:
|
|
121
|
+
<ul>
|
|
122
|
+
<li>Click</li>
|
|
123
|
+
<li>Clear</li>
|
|
124
|
+
<li>Send Keys</li>
|
|
125
|
+
<li>Get Value</li>
|
|
126
|
+
<li>Get Text</li>
|
|
127
|
+
<li>Get Attribute</li>
|
|
128
|
+
<li>Element Screenshot</li>
|
|
129
|
+
<li>Hover</li>
|
|
130
|
+
</ul>
|
|
131
|
+
</p>
|
|
132
|
+
<p><b>Text to Send</b> if the Send Keys action is selected, this value would send the text to the selected web element.<br></p>
|
|
133
|
+
</script>
|