topological-nodered-wdio 0.5.4 → 1.1.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 +209 -133
- package/src/element-action.js +107 -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
|
+
}
|