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


TypeScript AppiumDriver.findElementsByClassName方法代码示例

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


在下文中一共展示了AppiumDriver.findElementsByClassName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 add element in the list", async () => {
     const addField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
     await addField.sendKeys(fruit);
     const allImages = await driver.findElementsByClassName(driver.locators.image); // First image is the menu, second is the cross adding to the list.
     await allImages[1].click(); // Cross image button to add the item.
     const appleItem = await driver.findElementByText(fruit);
     expect(appleItem).to.exist;
 });
开发者ID:tjvantoll,项目名称:sample-Groceries,代码行数:8,代码来源:groceries.e2e.ts

示例3: async

 const clickOnCrossOrCheckboxBtn = async () => {
     if (isAndroid) {
         // First image is the menu, second is the cross button. The rest are pairs checkbox/bin per list item.
         const allImages = await driver.findElementsByClassName(driver.locators.image);
         await allImages[2].click(); // Checkbox button
     } else {
         await driver.clickPoint(26, 160); // Checkbox button
     }
 };
开发者ID:tjvantoll,项目名称:sample-Groceries,代码行数:9,代码来源:groceries.e2e.ts

示例4: it

        it("Verify validation of components", async () => {
            let fields;
            let username;
            let password;
            let email;
            let phone;
            let pin;
            if (isAndroid) {
                fields = await driver.findElementsByClassName("android.widget.EditText");
                username = fields[0];
                password = fields[1];
                email = fields[2];
                phone = fields[4];
                pin = fields[5];
            }
            else {
                fields = await driver.findElementsByClassName("TextField");
                password = await driver.findElementByClassName("SecureTextField");
                username = fields[0];
                email = fields[1];
                phone = fields[3];
                pin = fields[4];
            }

            await username.click();
            await username.sendKeys("usernamevalidation");
            if (isAndroid) {
                await driver.driver.hideDeviceKeyboard("Done");
            }
            const userNameValidation = await driver.findElementByText("Username can be at most 12 characters.", SearchOptions.exact);
            expect(userNameValidation).to.exist;

            await password.click();
            await password.sendKeys("pass");
            if (isAndroid) {
                await driver.driver.hideDeviceKeyboard("Done");
            }
            const passwordValidation = await driver.findElementByText("Password must be at least 6 characters long.", SearchOptions.exact);
            expect(passwordValidation).to.exist;

            await email.click();
            await email.sendKeys("email");
            let emailValidation;
            if (isAndroid) {
                await driver.driver.hideDeviceKeyboard("Done");
                emailValidation = await driver.findElementByText("This email is invalid.", SearchOptions.exact);
            }
            else {
                emailValidation = await driver.findElementByText("Incorrect e-mail!", SearchOptions.exact);
            }
            expect(emailValidation).to.exist;

            if (!isAndroid) {
                await phone.sendKeys("08");
                const phoneValidation = await driver.findElementByText("Incorrect phone number", SearchOptions.exact);
                expect(phoneValidation).to.exist;


                await pin.sendKeys("00");
                const pinValidation = await driver.findElementByText("PIN number should contain 4 digits.", SearchOptions.exact);
                expect(pinValidation).to.exist;
            }

            let switchButton;
            let switchValidation;

            if (isAndroid) {
                switchButton = await driver.findElementByClassName("android.widget.Switch");
                await switchButton.click();
                await switchButton.click();
                const wd = driver.wd();
                const action = new wd.TouchAction(driver.driver);
                action.press({ x: 52, y: 700 })
                    .moveTo({ x: 52, y: 100 })
                    .release();
                await action.perform();
                switchValidation = await driver.findElementByText("You must agree with the terms.", SearchOptions.exact);
            }
            else {
                switchButton = await driver.findElementByClassName("Switch");
                await switchButton.click();
                await switchButton.click();
                switchValidation = await driver.findElementByText("You must agree with the terms.", SearchOptions.exact);
                expect(switchValidation).to.exist;
            }
        });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:86,代码来源:test.e2e.ts


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