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