From 39e8f52bef734cf6fa1b70e8f6dcd45eb454a3a8 Mon Sep 17 00:00:00 2001 From: "lukoyanov94@mail.ru" Date: Tue, 5 Mar 2019 12:40:57 +0300 Subject: [PATCH] fix locator simplify call, fix toxpath function --- lib/helper/Appium.js | 2 +- lib/locator.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helper/Appium.js b/lib/helper/Appium.js index 805796c96..5980d554a 100644 --- a/lib/helper/Appium.js +++ b/lib/helper/Appium.js @@ -1353,7 +1353,7 @@ function parseLocator(locator) { if (locator.type === 'css' && !this.isWeb) throw new Error('Unable to use css locators in apps. Locator strategies for this request: xpath, id, class name or accessibility id'); if (locator.type === 'name' && !this.isWeb) throw new Error("Can't locate element by name in Native context. Use either ID, class name or accessibility id"); if (locator.type === 'id' && !this.isWeb && this.platform === 'android') return `//*[@resource-id='${locator.value}']`; - return locator.stringify(); + return locator.simplify(); } // in the end of a file diff --git a/lib/locator.js b/lib/locator.js index f38c42742..b37af3348 100644 --- a/lib/locator.js +++ b/lib/locator.js @@ -97,7 +97,7 @@ class Locator { toXPath() { if (this.isXPath()) return this.value; - if (this.isCSS) return cssToXPath(this.value); + if (this.isCSS()) return cssToXPath(this.value); throw new Error('Can\'t be converted to XPath'); }