diff --git a/lib/api/_loaders/element-global.js b/lib/api/_loaders/element-global.js index 6ae3b8f882..c0ab172c35 100644 --- a/lib/api/_loaders/element-global.js +++ b/lib/api/_loaders/element-global.js @@ -34,8 +34,7 @@ class ElementGlobal { static element({locator, testSuite, client, options}) { const instance = new ElementGlobal({testSuite, client, options}); - const byInstance=Locator.create(locator); - instance.setLocator(byInstance); + instance.setLocator(locator); return instance.exported(); } @@ -88,7 +87,9 @@ class ElementGlobal { return; } - this.element = await this.transport.driver.wait(until.elementLocated(locator), this.timeout, null, this.retryInterval); + const byLocator=Locator.create(locator); + + this.element = await this.transport.driver.wait(until.elementLocated(byLocator), this.timeout, null, this.retryInterval); } static isElementObject(element) {