diff --git a/static_src/test/functional/pageobjects/base.element.js b/static_src/test/functional/pageobjects/base.element.js index be8ee2fb..4f9f0766 100644 --- a/static_src/test/functional/pageobjects/base.element.js +++ b/static_src/test/functional/pageobjects/base.element.js @@ -10,9 +10,18 @@ * to deal with a single component. **/ +import assert from 'assert'; + export default class BaseElement { - constructor(browser, webElement) { + constructor(browser, webElementOrSelector) { this.browser = browser; + + let webElement = webElementOrSelector; + if (typeof webElementOrSelector === 'string') { + webElement = browser.element(webElementOrSelector); + } + + assert(webElement.value, `Element '${webElement.selector}' does not exist in the DOM.`); this.webElementId = webElement.value.ELEMENT; }