當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript AppiumDriver.findElementByAccessibilityId方法代碼示例

本文整理匯總了TypeScript中nativescript-dev-appium.AppiumDriver.findElementByAccessibilityId方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AppiumDriver.findElementByAccessibilityId方法的具體用法?TypeScript AppiumDriver.findElementByAccessibilityId怎麽用?TypeScript AppiumDriver.findElementByAccessibilityId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nativescript-dev-appium.AppiumDriver的用法示例。


在下文中一共展示了AppiumDriver.findElementByAccessibilityId方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

        it("Verify data-form components are visible", async () => {
            if (isAndroid) {
                let ageLabel = await driver.findElementByText("23", SearchOptions.exact);
                expect(ageLabel).to.exist;

                let email = await driver.findElementByText("john@company.com", SearchOptions.exact);
                expect(email).exist;

                let streetLabel = await driver.findElementByText("11", SearchOptions.exact);
                expect(streetLabel).to.exist;
            }

            else {
                let incrementBtn = await driver.findElementByXPath("(//XCUIElementTypeButton[@name=\"Increment\"])[1]");
                await incrementBtn.click();

                let ageLabel = await driver.findElementByAccessibilityId("24");
                expect(ageLabel).to.exist;

                let email = await driver.findElementByText("john@company.com", SearchOptions.exact);
                expect(email).exist;

                let incrementBtn2 = await driver.findElementByXPath("(//XCUIElementTypeButton[@name=\"Decrement\"])[2]");
                await incrementBtn2.click();
                let streetLabel = await driver.findElementByAccessibilityId("10");
                expect(streetLabel).to.exist;
            }
        });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:28,代碼來源:test.e2e.ts

示例2: it

        it("Verify Buttons on the page are responsive", async () => {
            const addBtn = await driver.findElementByText("ADD", SearchOptions.exact);
            expect(addBtn).to.exist;
            const delBtn = await driver.findElementByText("DEL", SearchOptions.exact);
            expect(delBtn).to.exist;
            const updateBtn = await driver.findElementByText("UPDATE", SearchOptions.exact);
            expect(updateBtn).to.exist;
            const resetBtn = await driver.findElementByText("RESET", SearchOptions.exact);
            expect(resetBtn).to.exist;

            await addBtn.click();
            const itemNew = isAndroid ? await driver.findElementByText("the new item", SearchOptions.contains)
                : await driver.findElementByAccessibilityId("This is the new item's description.", SearchOptions.exact);
            expect(itemNew).to.exist;
            await delBtn.click();
            await driver.wait(1000);
            const itemDeleted = await driver.findElementByTextIfExists("the new item", SearchOptions.contains);
            expect(itemDeleted).to.be.undefined;

            await addBtn.click();
            const item1 = isAndroid ? await driver.findElementByText("the new item", SearchOptions.contains)
                : await driver.findElementByAccessibilityId("This is the new item's description.");
            expect(item1).to.exist;
            await updateBtn.click();
            const itemUpdated = isAndroid ? await driver.findElementByText("an updated item", SearchOptions.contains)
                : await driver.findElementByAccessibilityId("This is an updated item");
            expect(itemUpdated).to.exist;
        });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:28,代碼來源:tests4.e2e.ts

示例3: async

    const getElement = async (id: number) => {
        let label = null;
        let button = null;
        
        if (driver.platformName.toLowerCase().includes("ios")) {
            label = await driver.findElementByAccessibilityId(
                "label: " + id.toString());

            button = await driver.findElementByAccessibilityId(
                id.toString());
        } else {
            label = await driver.findElementByAutomationText(
                "label: " + id.toString());

            button = await driver.findElementByAutomationText(
                id.toString());
        }

        return { label, button };
    };
開發者ID:NathanWalker,項目名稱:nativescript-angular,代碼行數:20,代碼來源:ngforof.e2e-spec.ts

示例4: it

        it("should open Customization view", async () => {
            await navigateBackToHome(driver);
            const customizationButton = await driver.findElementByText(customizationText);
            await customizationButton.click();
            const customizationTitle = await driver.findElementByText(customizationText);
            expect(customizationTitle).to.exist;
            await driver.wait(1000);
            const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
            await textField.sendKeys("Bul");
            const suggestionImage = isAndroid ?
                await driver.findElementByClassName("com.telerik.widget.autocomplete.SuggestionItemViewHolder") :
                await driver.findElementByAccessibilityId("bulgaria");
            const compareSuggestion = await driver.compareElement(suggestionImage, "customization-suggestion");
            expect(compareSuggestion).to.be.true;

            const suggestionText = await driver.findElementByText("Bulgaria");
            await suggestionText.click();
            const autoCompleteClassName = isAndroid ? "com.telerik.widget.autocomplete.RadAutoCompleteTextView" : driver.locators.getElementByName("scrollview");
            const autoComplete = await driver.findElementByClassName(autoCompleteClassName);
            const compareToken = await driver.compareElement(autoComplete, "customization-tokens");
            expect(compareToken).to.be.true;
        });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:22,代碼來源:tests.e2e.ts

示例5: getOptionsButton

export function getOptionsButton(driver: AppiumDriver): Promise<UIElement> {
    return isAndroid ?
        driver.findElementByAccessibilityId(moreOptionsID) :
        driver.findElementByText(optionsText);
}
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:5,代碼來源:helper.ts


注:本文中的nativescript-dev-appium.AppiumDriver.findElementByAccessibilityId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。