topological-nodered-wdio 0.4.4 → 0.4.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "topological-nodered-wdio",
3
3
  "description": "Open source WebdriverIO nodes for Node-RED",
4
- "version": "0.4.4",
4
+ "version": "0.4.6",
5
5
  "author": "topological",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,10 +33,10 @@
33
33
  inputs: 1,
34
34
  outputs: 1,
35
35
  icon: 'white-globe.png',
36
- label: function() {
36
+ label: function () {
37
37
  return this.name || 'dropdown action'
38
38
  },
39
- oneditprepare: function() {
39
+ oneditprepare: function () {
40
40
  setDropdownAction()
41
41
  }
42
42
  })
@@ -46,10 +46,14 @@
46
46
  <div class="form-row">
47
47
  <label for="node-input-locateUsing"><i class="fa fa-tasks"></i> Locate Method</label>
48
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="selector">Jquery Selector</option>
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>
53
57
  </select>
54
58
  </div>
55
59
  <div class="form-row">
@@ -118,4 +122,4 @@
118
122
  <li>Get Value</li>
119
123
  </ul>
120
124
  </p>
121
- </script>
125
+ </script>
@@ -12,11 +12,12 @@ module.exports = function(RED) {
12
12
  let locateValue = config.locateValue || msg.locateValue
13
13
 
14
14
  let browser = await common.getBrowser(node.context())
15
- let element = await common.getElement(
15
+ let locator = await common.getLocator(
16
16
  browser,
17
17
  locateUsing,
18
18
  locateValue
19
19
  )
20
+ let element = await browser.$(locator)
20
21
 
21
22
  let text = config.text || msg.text
22
23
  let attribute = config.attribute || msg.attribute
@@ -53,6 +53,7 @@
53
53
  <select type="text" id="node-input-webdriverBrowser" style="width:70%;">
54
54
  <option value="chrome" selected>Chrome</option>
55
55
  <option value="chromium">Chromium</option>
56
+ <option value="custom">Custom</option>
56
57
  </select>
57
58
  </div>
58
59
  <div class="form-row">
@@ -86,8 +87,7 @@
86
87
  <dd>The string format should be <protocal>://<hotsname>:<port number>/<path>, user 80/8080/443 if it is service based webdriver provider.</dd>
87
88
  <dd><code>msg.webdriverUri</code> can be used by leaving the webdriverUri field blank.</dd>
88
89
  <dt>Browser: <span class="property-type">string</span></dt>
89
- <dd>Current configurations are only for chrome.</dd>
90
- <dd><code>msg.webdriverBrowser</code> can be used by leaving the webdriverBrowser blank.</dd>
90
+ <dd>Chrome configs are default. We can pass custom capabilities by selecting Browser as `Custom` and pass `msg.capabilities` to the node.</dd>
91
91
  <dt>logLevel: <span class="property-type">string</span></dt>
92
92
  <dd>Select the log level to display the logs on console during run.</dd>
93
93
  <dt>killSession: <span class="property-type">Bool</span></dt>
@@ -12,11 +12,11 @@ module.exports = function(RED) {
12
12
  const webdriverConfig = Object.assign(
13
13
  { logLevel: config.logLevel },
14
14
  parseUri(config.webdriverUri || msg.webdriverUri, node),
15
- getCapabilities(
15
+ config.browser != "custom"? getCapabilities(
16
16
  config.webdriverProvider,
17
- config.webdriverBrowser || msg.webdriverBrowser,
17
+ config.webdriverBrowser,
18
18
  config.browserlessToken
19
- )
19
+ ) : msg.capabilities
20
20
  )
21
21
  node.log = `Open new browser.`
22
22
  let b = await common.newSession(webdriverConfig, node, node.context())