本文整理汇总了TypeScript中protractor.by.xpath方法的典型用法代码示例。如果您正苦于以下问题:TypeScript by.xpath方法的具体用法?TypeScript by.xpath怎么用?TypeScript by.xpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.by
的用法示例。
在下文中一共展示了by.xpath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('Changing "Label" dropdown to "none" should remove all chart labels', () => {
// Click "none"
element.all(by.xpath('//graph-demo/div[1]/div[2]/div[1]/select/option')).get(0).click();
// Both "minmax" and "all" will place a label on the first rect (0)
const rect = element.all(by.tagName('text'))
.get(0)
.getText()
.then((text) => {
expect(text.length).toEqual(0);
});
});
示例2: clickOnRow
clickOnRow(id: string) {
let idElement = element(by.css('a[title="' + id +'"]'));
let td = idElement.element(by.xpath('../..')).all(by.css('td')).get(9);
let detailsPane = element(by.css('.metron-slider-pane-details'));
return waitForElementPresence(idElement)
.then(() => browser.actions().mouseMove(idElement).perform())
.then(() => browser.actions().mouseMove(td).perform())
.then(() => browser.actions().click().perform())
.then(() => waitForElementVisibility(detailsPane))
.then(() => browser.sleep(2000));
}
示例3: ElementLocator
ElementLocator(obj) {
switch (obj.type) {
case IdentificationType[IdentificationType.Xpath]:
return element(by.xpath(obj.value));
case IdentificationType[IdentificationType.ClassName]:
return element(by.className(obj.value));
case IdentificationType[IdentificationType.Id]:
return element(by.id(obj.value));
case IdentificationType[IdentificationType.Js]:
return element(by.js(obj.value));
case IdentificationType[IdentificationType.Css]:
return element(by.css(obj.value));
case IdentificationType[IdentificationType.Name]:
return element(by.name(obj.value));
default:
break;
}
}
示例4: element
export function inputElement<T>(locator: Locator): InputElementFinder<T> {
let elem = element(locator) as any as InputElementFinder<T>;
elem.setValue = setValue;
elem.getValue = getValue;
elem.validationElem = elem.element(by.xpath('following-sibling::span'));
return elem;
function getValue() {
return elem.getAttribute('value');
}
function setValue(arg: T) {
let val: string;
if (typeof arg === 'number') {
val = arg.toString();
} else {
val = (arg || '').toString();
}
elem.clear();
return elem.sendKeys(val);
}
}
示例5: getAlertStatusById
getAlertStatusById(id: string) {
return element(by.css('a[title="' + id + '"]'))
.element(by.xpath('../..')).all(by.css('td a')).get(8).getText();
}
示例6: playerKnown
async playerKnown(name: string): Promise<boolean> {
return await element.all(by.xpath(`//td[normalize-space(text())="${name}"]`)).count() > 0;
}
示例7: getDefaultSavedSearchValue
getDefaultSavedSearchValue() {
browser.sleep(1000);
return element(by.linkText('Saved Searches')).element(by.xpath('..')).all(by.css('i')).getText();
}
示例8: it
it('should render Hero Bios', function () {
let heroBios = element.all(by.xpath('//h3[text()="Hero Bios"]')).get(0);
expect(heroBios).toBeDefined();
});