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


TypeScript AppiumDriver.findElementsByText方法代碼示例

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


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

示例1: it

            it("Verify list view events", async () => {
                const categoryTitle = await driver.findElementByText("Category 1", SearchOptions.exact);
                expect(categoryTitle).to.exist;
                let item = await driver.findElementByText("Special Item 111", SearchOptions.exact);
                let event;
                if (isAndroid) {
                    await item.hold();
                    event = await driver.findElementByText("onItemSelected for: Special Item 111");
                    expect(event).to.exist;
                    await item.hold();
                    event = await driver.findElementByText("onItemDeselected for: Special Item 111");
                    expect(event).to.exist;
                }

                await item.click();
                event = await driver.findElementByText("onItemTap for: Special Item 111");
                expect(event).to.exist;

                item = await driver.findElementByText("Special Item 111", SearchOptions.exact);
                await swipe(driver, item, Direction.right);
                const onSwipeEvent = isAndroid ? "onSwipeCellStarted item: Special Item 111" : "onSwipeCellFinished item: Special Item 111";
                event = await driver.findElementByText(onSwipeEvent, SearchOptions.contains);
                expect(event).to.exist;
                const markButtons = await driver.findElementsByText("mark");
                let alert, okButton;
                // Alert causes UI tree to become empty on Android
                if (!isAndroid) {

                    await markButtons[0].click();
                    alert = await driver.findElementByText("Left swipe click for: Special Item 111", SearchOptions.contains);
                    expect(alert).to.exist;
                    okButton = await driver.findElementByText("OK", SearchOptions.exact);
                    await okButton.click();
                }

                await item.click();
                await swipe(driver, item, Direction.left);
                event = await driver.findElementByText(onSwipeEvent, SearchOptions.contains);
                expect(event).to.exist;

                if (!isAndroid) {
                    const deleteButtons = await driver.findElementsByText("delete");
                    await deleteButtons[0].click();
                    alert = await driver.findElementByText("Right swipe click for: Special Item 111", SearchOptions.contains);
                    expect(alert).to.exist;
                    await okButton.click();
                }
            });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:48,代碼來源:tests.e2e.ts

示例2: it

    it("should skip first navigate back", async function () {
        if (driver.isIOS) {
            this.skip();
        }

        await driver.navBack();
        const textElement = await driver.findElementsByText("will cancel next back press: false", SearchOptions.contains, elementDefaultWaitTimeInSeconds);
        assert.isTrue(textElement !== null);
        await driver.navBack();
        await screen.loadedHome();
    })
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:11,代碼來源:android-back-button.e2e-spec.ts

示例3: it

        it("should find elements", async () => {
            await driver.findElementByAutomationText("First Tab");

            const notSelectedTabItems = await driver.findElementsByText("not selected");

            firstTabItem = await driver.findElementByAutomationText("SELECTED");
            secondTabItem = notSelectedTabItems[0];
            thirdTabItem = notSelectedTabItems[1];

            const screenMatches = await driver.compareScreen("tab-view-binding-first-tab", 5);
            assert(screenMatches);
        });
開發者ID:NathanWalker,項目名稱:nativescript-angular,代碼行數:12,代碼來源:tab-view.e2e-spec.ts

示例4: it

 it("Delete item", async () => {
     let item = await driver.findElementByText("NativeScript First-Time", SearchOptions.contains);
     await swipe(driver, item, Direction.left);
     if (isAndroid) {
         const deleteButtons = await driver.findElementsByText("delete", SearchOptions.exact);
         await deleteButtons[2].click();
     } else {
         const deleteButton = await driver.findElementByText("delete", SearchOptions.exact);
         await deleteButton.click();
     }
     item = await driver.findElementByTextIfExists("NativeScript First-Time", SearchOptions.contains);
     expect(item).to.be.undefined;
 });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:13,代碼來源:tests2.e2e.ts

示例5: it

        it("should open 'Suggest and Append' view", async () => {
            await navigateBackToView(driver, suggestModeText);
            const suggestAndAppendButton = await driver.findElementByText("Suggest & Append");
            await suggestAndAppendButton.click();
            await driver.wait(1000);
            const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
            await textField.sendKeys("B");
            const bulgariaRecords = await driver.findElementsByText("Bulgaria");
            expect(bulgariaRecords.length).to.equal(2);

            await bulgariaRecords[1].click();
            const bulgaria = await driver.findElementByText("Bulgaria");
            expect(bulgaria).to.exist;
        });
開發者ID:telerik,項目名稱:nativescript-ui-samples-angular,代碼行數:14,代碼來源:tests.e2e.ts


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