本文整理汇总了TypeScript中protractor.ElementFinder.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ElementFinder.getAttribute方法的具体用法?TypeScript ElementFinder.getAttribute怎么用?TypeScript ElementFinder.getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.ElementFinder
的用法示例。
在下文中一共展示了ElementFinder.getAttribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getBodyScrollHeight
getBodyScrollHeight(): promise.Promise<number> {
const body: ElementFinder = element(by.css('body'));
return body.getAttribute('scrollHeight').then((bodyScrollHeightString: string) => {
return +bodyScrollHeightString;
});
}
示例2: it
it('should select value and close dropdown', async () => {
select.element(by.css('.ng-select-container')).click();
select.all(by.css('.ng-option')).first().click();
expect(select.getAttribute('class')).not.toMatch('ng-select-opened');
const text = await element(by.id('ngModel')).getText();
expect(text).toEqual('1');
});
示例3: check
export function check(el: ElementFinder) {
Util.waitUntilElementIsVisible(el);
el.getAttribute('class').then((classList) => {
if (classList && classList.indexOf('mat-checked') === -1) {
el.click();
expect(el.getAttribute('class')).toContain('mat-checked');
}
});
}
示例4: changeInputValue
public static changeInputValue(elemFinder: ElementFinder, fieldName: string, viewModel: any, backupModel?: any) {
elemFinder.getAttribute('value').then((value: string) => {
if (backupModel) {
backupModel[fieldName] = value;
}
elemFinder.clear();
elemFinder.sendKeys(viewModel[fieldName]);
console.log('Change value for ' + fieldName + ' from "' + value + '" to "' + viewModel[fieldName] + '"');
});
}
示例5: appendTimestamp
public static appendTimestamp(elemFinder: ElementFinder, timestamp: string) {
elemFinder.getAttribute('value').then((value: string) => {
let index: number = value.indexOf('@');
if(index > 0) {
value = value.substring(0, index);
}
elemFinder.clear();
elemFinder.sendKeys(value + timestamp);
});
}
示例6: getElementAttribute
async getElementAttribute(xpath:string, attribute:string):Promise<string>{
var ele:ElementFinder = await this.curBrowser.element(by.xpath(xpath))
var attributeValue:string =""
await this.curBrowser.wait(this.until.presenceOf(ele), this.timeOut, 'Element ' + xpath + ' takes too long to appear in the DOM' )
await ele.getAttribute(attribute).then(function(value){
console.log("Attribute value: " + value)
attributeValue = value
})
return attributeValue
}
示例7: checkInputValueEqual
public static checkInputValueEqual(elemFinder: ElementFinder, elemName: string, expectValue: string | number) {
elemFinder.getAttribute('value').then((value: string) => {
if(typeof expectValue === 'number') {
expect(value).toEqual(expectValue.toString());
console.log('Check if ' + elemName + ' is "' + value + '": ' + (expectValue.toString() === value));
} else {
expect(value).toEqual(expectValue);
console.log('Check if ' + elemName + ' is "' + value + '": ' + (expectValue === value));
}
});
}
示例8: return
return (target, propertyKey): PropertyDescriptor => {
return {
get() {
return elem.getAttribute('value');
},
set(input) {
elem.clear();
elem.sendKeys(input);
},
};
};
示例9: it
it('should populate the form control values in the DOM', () => {
expect(firstInput.getAttribute('value')).toEqual('Nancy');
expect(lastInput.getAttribute('value')).toEqual('Drew');
});
示例10: it
it('should set the value by changing the domain model', () => {
button.click();
expect(input.getAttribute('value')).toEqual('Nancy');
});