本文整理汇总了TypeScript中nativescript-dev-appium.AppiumDriver.findElementByAccessibilityId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AppiumDriver.findElementByAccessibilityId方法的具体用法?TypeScript AppiumDriver.findElementByAccessibilityId怎么用?TypeScript AppiumDriver.findElementByAccessibilityId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nativescript-dev-appium.AppiumDriver
的用法示例。
在下文中一共展示了AppiumDriver.findElementByAccessibilityId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("Verify data-form components are visible", async () => {
if (isAndroid) {
let ageLabel = await driver.findElementByText("23", SearchOptions.exact);
expect(ageLabel).to.exist;
let email = await driver.findElementByText("john@company.com", SearchOptions.exact);
expect(email).exist;
let streetLabel = await driver.findElementByText("11", SearchOptions.exact);
expect(streetLabel).to.exist;
}
else {
let incrementBtn = await driver.findElementByXPath("(//XCUIElementTypeButton[@name=\"Increment\"])[1]");
await incrementBtn.click();
let ageLabel = await driver.findElementByAccessibilityId("24");
expect(ageLabel).to.exist;
let email = await driver.findElementByText("john@company.com", SearchOptions.exact);
expect(email).exist;
let incrementBtn2 = await driver.findElementByXPath("(//XCUIElementTypeButton[@name=\"Decrement\"])[2]");
await incrementBtn2.click();
let streetLabel = await driver.findElementByAccessibilityId("10");
expect(streetLabel).to.exist;
}
});
示例2: 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;
});
示例3: async
const getElement = async (id: number) => {
let label = null;
let button = null;
if (driver.platformName.toLowerCase().includes("ios")) {
label = await driver.findElementByAccessibilityId(
"label: " + id.toString());
button = await driver.findElementByAccessibilityId(
id.toString());
} else {
label = await driver.findElementByAutomationText(
"label: " + id.toString());
button = await driver.findElementByAutomationText(
id.toString());
}
return { label, button };
};
示例4: it
it("should open Customization view", async () => {
await navigateBackToHome(driver);
const customizationButton = await driver.findElementByText(customizationText);
await customizationButton.click();
const customizationTitle = await driver.findElementByText(customizationText);
expect(customizationTitle).to.exist;
await driver.wait(1000);
const textField = await driver.findElementByClassName(driver.locators.getElementByName("textfield"));
await textField.sendKeys("Bul");
const suggestionImage = isAndroid ?
await driver.findElementByClassName("com.telerik.widget.autocomplete.SuggestionItemViewHolder") :
await driver.findElementByAccessibilityId("bulgaria");
const compareSuggestion = await driver.compareElement(suggestionImage, "customization-suggestion");
expect(compareSuggestion).to.be.true;
const suggestionText = await driver.findElementByText("Bulgaria");
await suggestionText.click();
const autoCompleteClassName = isAndroid ? "com.telerik.widget.autocomplete.RadAutoCompleteTextView" : driver.locators.getElementByName("scrollview");
const autoComplete = await driver.findElementByClassName(autoCompleteClassName);
const compareToken = await driver.compareElement(autoComplete, "customization-tokens");
expect(compareToken).to.be.true;
});
示例5: getOptionsButton
export function getOptionsButton(driver: AppiumDriver): Promise<UIElement> {
return isAndroid ?
driver.findElementByAccessibilityId(moreOptionsID) :
driver.findElementByText(optionsText);
}