Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1056 from 18F/ab/functional-web-element-fix
Browse files Browse the repository at this point in the history
Allow BaseElement to accept selector or WebElement
  • Loading branch information
Marco Segreto authored Apr 17, 2017
2 parents b7f1589 + 4f89f06 commit 2f1e20e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion static_src/test/functional/pageobjects/base.element.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2f1e20e

Please sign in to comment.