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


TypeScript AppiumDriver.findElementByText方法代码示例

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


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

示例1: it

        it("Reorder items and verify listview", async () => {
            let listView;
            let value;
            const listItem = await driver.findElementByText("Gwen Peters", SearchOptions.exact);
            expect(listItem).to.exist;
            // await listItem.drag(Direction.down, 600, 0);
            if (isAndroid) {
                const wd = driver.wd();
                const action = new wd.TouchAction(driver.driver);
                action.longPress({ x: 200, y: 200 })
                    .wait(2000)
                    .moveTo({ x: 200, y: 400 })
                    .release();
                await action.perform();
                listView = await driver.findElementsByClassName("android.widget.TextView");
                value = await listView[1].text();
                expect(value).to.equal("George Cook");
            }
            else {
                await driver.driver.execute('mobile: dragFromToForDuration', {
                    duration: 2.0,
                    fromX: 100,
                    fromY: 105,
                    toX: 100,
                    toY: 242
                });
                listView = await driver.findElementsByClassName("XCUIElementTypeStaticText");
                value = await listView[1].getAttribute("value");
                let element = await driver.findElementByText("George Cook");
                expect(element).to.exist;
                // TODO: Add assertion for listview items
            }

        });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:34,代码来源:tests2.e2e.ts

示例2: it

 it("should return back an item from the Recent list", async () => {
     await clickOnCrossOrCheckboxBtn();
     const doneButton = await driver.findElementByText(doneButtonText);
     await doneButton.click();
     const appleItem = await driver.findElementByText(fruit);
     expect(appleItem).to.exist;
 });
开发者ID:tjvantoll,项目名称:sample-Groceries,代码行数:7,代码来源:groceries.e2e.ts

示例3: it

 it("Navigate to Validators page", async () => {
     await navigateBackToHome(driver);
     const validationTitle = await driver.findElementByText("Validation", SearchOptions.exact);
     await validationTitle.click();
     const validators = await driver.findElementByText("Validators", SearchOptions.exact);
     await validators.click();
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:7,代码来源:test.e2e.ts

示例4: it

 it("Tap disable btn and verify swipe is disabled", async () => {
     const disableBtn = await driver.findElementByText("DISABLE", SearchOptions.exact);
     await disableBtn.click();
     let item = await driver.findElementByText("Joel Robertson", 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(100)
             .moveTo({ x: 10, y: centerY })
             .release();
         await action.perform();
         const selection = await driver.compareElement(item, "item");
         expect(selection).to.equal(true);
     }
     else {
         await driver.driver.execute('mobile: dragFromToForDuration', {
             duration: 2.0,
             fromX: 150,
             fromY: 150,
             toX: 50,
             toY: 150
         });
         const del = await driver.findElementByTextIfExists("delete", SearchOptions.exact);
         expect(del).to.be.undefined;
     }
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:31,代码来源:tests3.e2e.ts

示例5: it

        it("should open Async Data Fetch view", async () => {
            await navigateBackToHome(driver);
            const asyncDataFetchButton = await driver.findElementByText(asyncDataFetchText);
            await asyncDataFetchButton.click();
            await driver.wait(1000);
            const asyncDataFetchTitle = await driver.findElementByText(asyncDataFetchText);
            expect(asyncDataFetchTitle).to.exist;

            const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
            if (isAndroid) {
                await textField.sendKeys("a");
                // await clickBelowElement(textField, driver);
                // let aiomeAirport = await driver.findElementByTextIfExists("Aiome", SearchOptions.exact, 500);
                // expect(aiomeAirport).not.to.exist;
                await driver.wait(5000);
                await clickBelowElement(textField, driver);
                const aiomeAirport = await driver.findElementByTextIfExists("Aiome");
                expect(aiomeAirport).to.exist;
            }

            // Error prompt test
            // const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
            // await textField.sendKeys("B");
            // const progressIndicator = await driver.findElementByText("In progress");
            // expect(progressIndicator).to.exist;
            // const buttons = await driver.findElementsByClassName(driver.locators.button);
            // await buttons[4].click();
            // await driver.wait(1000);
            // const returnButton = await driver.findElementByTextIfExists("Return");
            // if(returnButton !== undefined){
            //     await driver.driver.hideDeviceKeyboard("Return");
            //     await driver.wait(1000);
            // }
        });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:34,代码来源:tests.e2e.ts

示例6: it

    it("should play animation simultaneously", async () => {
        const button = await driver.findElementByText("Animate Simultaneously", SearchOptions.exact);
        await button.click();

        const label = await driver.findElementByText("{{N4}}", SearchOptions.exact);
        assert.isTrue(await label.isDisplayed());
    });
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:7,代码来源:animation.e2e-spec.ts


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