當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。