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