当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AppiumDriver.findElementByTextIfExists方法代码示例

本文整理汇总了TypeScript中nativescript-dev-appium.AppiumDriver.findElementByTextIfExists方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AppiumDriver.findElementByTextIfExists方法的具体用法?TypeScript AppiumDriver.findElementByTextIfExists怎么用?TypeScript AppiumDriver.findElementByTextIfExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nativescript-dev-appium.AppiumDriver的用法示例。


在下文中一共展示了AppiumDriver.findElementByTextIfExists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: navigateBackToHome

export async function navigateBackToHome(driver: AppiumDriver, view?: string) {
    let location = view !== undefined ? view : "ListView Angular";
    let homeTitle = await driver.findElementByTextIfExists(location, SearchOptions.exact);
    while (homeTitle === undefined) {
        await driver.navBack();
        await driver.wait(1000);
        homeTitle = await driver.findElementByTextIfExists(location, SearchOptions.exact);
    }
}
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:9,代码来源:helper.ts

示例2: it

 it("Select an item and verify its style", async () => {
     let item = await driver.findElementByText("Gwen Peters", SearchOptions.exact);
     await item.click();
     let selectedItem = await driver.findElementByTextIfExists("Selected items: Gwen Peters", SearchOptions.exact);
     expect(selectedItem).to.exist;
     item = await driver.findElementByText("George Cook", SearchOptions.exact);
     await item.click();
     selectedItem = await driver.findElementByTextIfExists("Selected items: George Cook", SearchOptions.exact);
     expect(selectedItem).to.exist;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:10,代码来源:tests2.e2e.ts

示例3: 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

示例4: goBack

export async function goBack(driver: AppiumDriver) {
    const backButtonText = "Back";
    const backButton = await driver.findElementByTextIfExists(backButtonText);
    if (backButton !== undefined) {
        await backButton.click();
    }
}
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:7,代码来源:helper.ts

示例5: it

 it("Swipe item left, delete it and verify it is deleted", async () => {
     let item = await driver.findElementByText("Joyce Dean", SearchOptions.exact);
     expect(item).to.exist;
     if (isAndroid) {
         const rectangle = await item.getRectangle();
         const centerX = rectangle.x + rectangle.width / 2;
         const centerY = rectangle.y + rectangle.height / 2;
         const wd = driver.wd();
         const action = new wd.TouchAction(driver.driver);
         action.press({ x: centerX, y: centerY })
             .wait(150)
             .moveTo({ x: 10, y: centerY })
             .release();
         await action.perform();
     }
     else {
         await driver.driver.execute('mobile: dragFromToForDuration', {
             duration: 2.0,
             fromX: 150,
             fromY: 120,
             toX: 50,
             toY: 120
         });
     }
     let delBtn = await driver.findElementByText("delete", SearchOptions.exact);
     await delBtn.click();
     item = await driver.findElementByTextIfExists("Joyce Dean", SearchOptions.exact);
     expect(item).to.be.undefined;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:29,代码来源:tests3.e2e.ts

示例6: it

        it("should open 'Switch at runtime' view", async () => {
            await navigateBackToHome(driver);
            const tokenLayoutsButton = await driver.findElementByText(tokenLayoutsText);
            await tokenLayoutsButton.click();
            await driver.wait(1000);
            const tokenLayoutsTitle = await driver.findElementByText(tokenLayoutsText);
            expect(tokenLayoutsTitle).to.exist;

            const runtimeSwitchButton = await driver.findElementByText("Switch at runtime");
            await runtimeSwitchButton.click();
            await driver.wait(1000);
            const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
            await textField.click();
            const addNextTokenButton = await driver.findElementByText("Add next token");
            for (let i = 0; i < 5; i++) {
                await addNextTokenButton.click();
            }
            const australiaToken = await driver.findElementByText("Australia");
            expect((await australiaToken.location()).x).to.be.least(0);

            const horizontalButton = await driver.findElementByText("Horizontal");
            await horizontalButton.click();
            const australiaTokenHorizontal = await driver.findElementByTextIfExists("Australia");
            expect((await australiaTokenHorizontal.location()).x).to.be.lessThan(0);
        });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:25,代码来源:tests.e2e.ts

示例7: it

 it("Shrink groups", async () => {
    const mainInfo = await driver.findElementByText("Main Info");
    await mainInfo.click();
    const address = await driver.findElementByText("Address");
    await address.click();
    const name = await driver.findElementByTextIfExists("Name");
    expect(name).to.be.undefined;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:8,代码来源:test.e2e.ts


注:本文中的nativescript-dev-appium.AppiumDriver.findElementByTextIfExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。