当前位置: 首页>>代码示例>>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;未经允许,请勿转载。