diff --git a/lib/appium-driver.d.ts b/lib/appium-driver.d.ts index 570907f..a580fb7 100644 --- a/lib/appium-driver.d.ts +++ b/lib/appium-driver.d.ts @@ -85,7 +85,7 @@ export declare class AppiumDriver { * @param text * @param waitForElement */ - findElementByAutomationText(automationText: string, waitForElement?: number): Promise; + findElementByAutomationText(automationText: string, waitForElement?: number): Promise; /** * Search for element by given automationText and waits until the element is displayed. * @param text diff --git a/lib/appium-driver.ts b/lib/appium-driver.ts index 34c3fc7..60300ab 100644 --- a/lib/appium-driver.ts +++ b/lib/appium-driver.ts @@ -321,9 +321,9 @@ export class AppiumDriver { */ public async findElementByAutomationText(automationText: string, waitForElement: number = this.defaultWaitTime) { if (this.isIOS) { - return await this.findElementByAccessibilityId(`${automationText}`, waitForElement); + return await this.findElementByAccessibilityIdIfExists(`${automationText}`, waitForElement); } - return await this.findElementByXPath(this._elementHelper.getXPathByText(automationText, true), waitForElement); + return await this.findElementByXPathIfExists(this._elementHelper.getXPathByText(automationText, true), waitForElement); } /** @@ -753,7 +753,7 @@ export class AppiumDriver { if (!this._args.attachToDebug) { await this._driver.quit(); } else { - await this._webio.detach(); + //await this._webio.detach(); } } catch (error) { } diff --git a/lib/ui-element.ts b/lib/ui-element.ts index 8dbadbd..73d6c60 100644 --- a/lib/ui-element.ts +++ b/lib/ui-element.ts @@ -273,7 +273,7 @@ export class UIElement { const endPoint = calculateOffset(direction, y, yOffset, x, xOffset, this._webio.isIOS, false); if (direction === Direction.down) { - endPoint.point.y += location.y; + //endPoint.point.y += location.y; } let action = new this._wd.TouchAction(this._driver); action @@ -292,11 +292,10 @@ export class UIElement { * @param yOffset * @param xOffset */ - public async scrollTo(direction: Direction, elementToSearch, yOffset: number = 0, xOffset: number = 0) { + public async scrollTo(direction: Direction, elementToSearch: () => Promise, yOffset: number = 0, xOffset: number = 0, retries: number = 10) { //await this._driver.execute("mobile: scroll", [{direction: 'up'}]) //await this._driver.execute('mobile: scroll', { direction: direction === 0 ? "down" : "up", element: this._element.ELEMENT }); let el: UIElement = null; - let retries = 7; while (el === null && retries >= 0) { try { el = await elementToSearch();