Skip to content
Permalink
Browse files

Make new W3C elementId as const

  • Loading branch information...
isnifer authored and christian-bromann committed May 1, 2017
1 parent 63908ce commit 909da3b79a6d7ddfe3085b8036956c782def2b43
@@ -215,8 +215,15 @@ const UNICODE_CHARACTERS = {
'ZenkakuHankaku': '\uE040'
}

/**
* W3C webdriver protocol has changed element identifier from `ELEMENT` to
* `element-6066-11e4-a52e-4f735466cecf`.
*/
const W3C_ELEMENT_ID = 'element-6066-11e4-a52e-4f735466cecf'

export {
COLORS,
ERROR_CODES,
UNICODE_CHARACTERS
UNICODE_CHARACTERS,
W3C_ELEMENT_ID
}
@@ -15,6 +15,7 @@

import findStrategy from '../helpers/findElementStrategy'
import hasElementResult from '../helpers/hasElementResultHelper'
import { W3C_ELEMENT_ID } from '../helpers/constants'
import q from 'q'

export default function element (selector) {
@@ -51,11 +52,11 @@ export default function element (selector) {
* `element-6066-11e4-a52e-4f735466cecf`. Let's make sure both identifier
* are supported.
*/
const elemValue = result.value.ELEMENT || result.value['element-6066-11e4-a52e-4f735466cecf']
const elemValue = result.value.ELEMENT || result.value[W3C_ELEMENT_ID]
if (elemValue) {
result.value = {
ELEMENT: elemValue,
'element-6066-11e4-a52e-4f735466cecf': elemValue
[W3C_ELEMENT_ID]: elemValue
}
}

@@ -16,6 +16,7 @@

import { ProtocolError } from '../utils/ErrorHandler'
import findStrategy from '../helpers/findElementStrategy'
import { W3C_ELEMENT_ID } from '../helpers/constants'

export default function elementIdElement (id, selector) {
if (typeof id !== 'string' && typeof id !== 'number') {
@@ -34,10 +35,10 @@ export default function elementIdElement (id, selector) {
* `element-6066-11e4-a52e-4f735466cecf`. Let's make sure both identifier
* are supported.
*/
const elemValue = result.value.ELEMENT || result.value['element-6066-11e4-a52e-4f735466cecf']
const elemValue = result.value.ELEMENT || result.value[W3C_ELEMENT_ID]
result.value = {
ELEMENT: elemValue,
'element-6066-11e4-a52e-4f735466cecf': elemValue
[W3C_ELEMENT_ID]: elemValue
}

return result
@@ -16,6 +16,7 @@

import { ProtocolError } from '../utils/ErrorHandler'
import findStrategy from '../helpers/findElementStrategy'
import { W3C_ELEMENT_ID } from '../helpers/constants'

export default function elementIdElements (id, selector) {
if (typeof id !== 'string' && typeof id !== 'number') {
@@ -35,10 +36,10 @@ export default function elementIdElements (id, selector) {
* are supported.
*/
result.value = result.value.map((elem) => {
const elemValue = elem.ELEMENT || elem['element-6066-11e4-a52e-4f735466cecf']
const elemValue = elem.ELEMENT || elem[W3C_ELEMENT_ID]
return {
ELEMENT: elemValue,
'element-6066-11e4-a52e-4f735466cecf': elemValue
[W3C_ELEMENT_ID]: elemValue
}
})

@@ -21,6 +21,7 @@ import q from 'q'

import findStrategy from '../helpers/findElementStrategy'
import hasElementResult from '../helpers/hasElementResultHelper'
import { W3C_ELEMENT_ID } from '../helpers/constants'
import { CommandError } from '../utils/ErrorHandler'

let elements = function (selector) {
@@ -86,10 +87,10 @@ let elements = function (selector) {
* are supported.
*/
result.value = result.value.map((elem) => {
const elemValue = elem.ELEMENT || elem['element-6066-11e4-a52e-4f735466cecf']
const elemValue = elem.ELEMENT || elem[W3C_ELEMENT_ID]
return {
ELEMENT: elemValue,
'element-6066-11e4-a52e-4f735466cecf': elemValue
[W3C_ELEMENT_ID]: elemValue
}
})

0 comments on commit 909da3b

Please sign in to comment.
You can’t perform that action at this time.