本文整理汇总了TypeScript中nativescript-dev-appium.UIElement类的典型用法代码示例。如果您正苦于以下问题:TypeScript UIElement类的具体用法?TypeScript UIElement怎么用?TypeScript UIElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UIElement类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
export const isAbove = async (first: UIElement, second: UIElement) => {
const { y: firstY } = await first.location();
const { y: secondY } = await second.location();
assert.isTrue(firstY < secondY);
}
示例2: isAbove
it("should toggle on both views in reverse", async () => {
await secondButton.click();
await firstButton.click();
let conditional1 = await driver.findElementByAutomationText("first");
let conditional2 = await driver.findElementByAutomationText("second");
await isAbove(firstLabel, conditional1);
await isAbove(conditional1, conditional2);
await isAbove(conditional2, secondLabel);
});
示例3: Error
(async () => {
await secondButton.click();
await firstButton.click();
driver.findElementByAutomationText("first", 500)
.then(_ => { throw new Error("first label found!"); })
.catch(() => {
driver.findElementByAutomationText("second", 500)
.then(_ => { throw new Error("second label found!"); })
.catch(() => done());
});
})();
示例4: async
const removeElement = async (index?: number) => {
if (index) {
let { button } = await elements[index];
await button.click();
} else {
index = elements.length - 1;
if (driver.platformName.toLowerCase().includes("ios")) {
await removeButton.tap();
} else {
await removeButton.click();
}
}
elements.splice(index, 1);
lastAddedElementId -= 1;
};
示例5: it
it("should find elements", async () => {
firstButton = await driver.findElementByAutomationText("Button 1");
secondButton = await driver.findElementByAutomationText("Button 2");
toggleButton = await driver.findElementByAutomationText("Toggle");
conditionalLabel = await driver.findElementByAutomationText("Label");
const labelIsDisplayed = await conditionalLabel.isDisplayed();
assert.isTrue(labelIsDisplayed);
});
示例6: catch
(async () => {
await toggleButton.click();
try {
await driver.findElementByAutomationText("Label");
} catch (e) {
done();
}
})();
示例7: async
const addElement = async () => {
await addButton.click();
lastAddedElementId += 1;
const newElement = await driver.findElementByAutomationText(
lastAddedElementId.toString());
elements.push(newElement);
};