本文整理匯總了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);
};