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


TypeScript AppiumDriver.findElementByClassName方法代码示例

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


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

示例1: scrollToElement

export async function scrollToElement(driver: AppiumDriver, element: string, direction: Direction = Direction.down) {
    let listView;
    if (isAndroid) {
        listView = await driver.findElementByClassName("android.widget.FrameLayout");
    }
    else {
        listView = await driver.findElementByClassName("XCUIElementTypeCollectionView");
    }
    const listItem = await listView.scrollTo(
        direction,
        () => driver.findElementByText(element, SearchOptions.contains),
        600
    );
    return listItem;
}
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:15,代码来源:helper.ts

示例2: it

 it("Scroll listview to verify more elements are present", async () => {
     let listView;
     if (isAndroid) {
         listView = await driver.findElementByClassName("android.widget.FrameLayout");
     }
     else {
         listView = await driver.findElementByClassName("XCUIElementTypeCollectionView");
     }
     const listItem = await listView.scrollTo(
         Direction.down,
         () => driver.findElementByText("Creme Caramel", SearchOptions.exact),
         600
     );
     expect(listItem).to.exist;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:15,代码来源:tests.e2e.ts

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

示例4: swipeToElement

export async function swipeToElement(driver: AppiumDriver, element: string, direction: Direction = Direction.down) {
    let listView;
    if (isAndroid) {
        listView = await driver.findElementByClassName("android.widget.FrameLayout");
    }
    else {
        listView = await driver.findElementByClassName("XCUIElementTypeCollectionView");
    }

    let item = await driver.findElementByTextIfExists(element, SearchOptions.exact);
    while (item === undefined) {
        await listView.swipe(direction);
        await driver.wait(500);
        item = await driver.findElementByTextIfExists(element, SearchOptions.exact);
    }
    return item;
}
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:17,代码来源:helper.ts

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

示例6: it

    it("should find an element by type", async () => {
        const btnTap = await driver.findElementByClassName(driver.locators.button);
        await btnTap.click();

        const message = " taps left";
        const lblMessage = await driver.findElementByText(message, SearchOptions.contains);
        expect(await lblMessage.text()).toContain("40");
    });
开发者ID:NativeScript,项目名称:nativescript-dev-appium,代码行数:8,代码来源:typescript.jasmine.sample.e2e-spec.ts

示例7: it

 it("Scroll and verify event is fired", async () => {
     const locator = isAndroid ? "android.widget.FrameLayout" : "XCUIElementTypeCollectionView";
     const listView = await driver.findElementByClassName(locator);
     const listItem = await listView.scrollTo(
         Direction.down,
         () => driver.findElementByText("Item 20", SearchOptions.exact),
         700
     );
     const scrollStateLabel = await driver.findElementByText("ended with offset:", SearchOptions.contains);
     expect(scrollStateLabel).to.exist;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:11,代码来源:tests3.e2e.ts

示例8: it

 it("Verify on Lost focus mode", async () => {
     const lostFocusTab = await driver.findElementByText("lost focus");
     await lostFocusTab.click();
     const username = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
     await username.sendKeys(" stark");
     try {
         await driver.driver.hideDeviceKeyboard();
     } catch (error) {
     }
     let result = await driver.findElementByText('"username":"tony"', SearchOptions.contains);
     expect(result).to.exist;
     const pass = await driver.findElementByText("Password");
     await pass.click();
     result = await driver.findElementByText('"username":"tony stark"', SearchOptions.contains);
     expect(result).to.exist;
 });
开发者ID:telerik,项目名称:nativescript-ui-samples-angular,代码行数:16,代码来源:test.e2e.ts


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