本文整理汇总了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();
}
});
示例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();
})
示例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);
});
示例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;
});
示例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;
});