本文整理匯總了TypeScript中protractor.ElementFinder.sendKeys方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ElementFinder.sendKeys方法的具體用法?TypeScript ElementFinder.sendKeys怎麽用?TypeScript ElementFinder.sendKeys使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類protractor.ElementFinder
的用法示例。
在下文中一共展示了ElementFinder.sendKeys方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createMovimiento
createMovimiento(date, importe, tipo, categoria) {
this.searchElements(categoria);
this.fecha.sendKeys(date);
this.importe.sendKeys(importe);
this.tipos.get(1).click();
this.categoria.click();
element(by.css('button')).click();
}
示例2: expect
browser.manage().logs().get('browser').then(() => {
trigger.sendKeys(protractor.Key.ENTER).then(() => {
browser.sleep(5000).then(() => {
// At the end of the time the scrolling should be at the specific target position
page.getScrollPos().then((pos: number) => {
expect(pos).toBeCloseTo(headingLocation.y, Closeness.ofByOne);
});
// Inspect the console logs, they should contain all in between scroll positions
// Using the browser.sleep() to execute some code while the animation is running does not work
// consistently across browser, especially causing problems with the CI server
browser.manage().logs().get('browser').then(browserLog => {
const scrollPositionHistory = browserLog
.filter(log => log.message.indexOf('Scroll Position: ') >= 0) // only take scroll position logs
.map(log => parseInt(log.message.split(' ').reverse()[0], 10)); // parse scroll logs into ints
expect(scrollPositionHistory.length).toBeGreaterThan(0);
// Iterate over all scroll position logs and make sure the increment is always nearly the same
// (as it should be the case for linear easing)
const totalScrollDistance = headingLocation.y - initialPos;
const averageScrollPosChange = scrollPositionHistory[scrollPositionHistory.length - 1]
/ scrollPositionHistory.length;
// Allow some variation (the exact absolute value is made to depend on the total scroll distance)
const closeToEpsilon = Closeness.ofBy(totalScrollDistance * 0.0075);
for (let i = 0; i < scrollPositionHistory.length - 2; i++) {
const scrollPosChange = scrollPositionHistory[i + 1] - scrollPositionHistory[i];
expect(scrollPosChange).toBeCloseTo(averageScrollPosChange, closeToEpsilon);
}
});
});
});
});
示例3: it
it('should report the validity correctly', () => {
expect(paragraphs.get(1).getText()).toEqual('Valid: false');
input.click();
input.sendKeys('a');
expect(paragraphs.get(1).getText()).toEqual('Valid: true');
});
示例4: it
it('should show the error when the form is invalid', () => {
firstInput.click();
firstInput.clear();
firstInput.sendKeys('a');
expect(element(by.css('div')).getText()).toEqual('Name is too short.');
});
示例5: it
it('should display Clickers when Clickers link is selected', () => {
element(by.css('.bar-button-menutoggle')).click();
element.all(by.css('ion-label')).first().click();
clickerField.sendKeys('deal with protractor');
clickerButton.click();
expect(clickerList.getText()).toContain('deal with protractor');
});
示例6: sendKeysOnElement
async sendKeysOnElement(xpath:string, data:string, timeOut=this.timeOut) {
console.log("Sending key to element " + xpath)
var ele:ElementFinder = await this.curBrowser.element(by.xpath(xpath));
await this.curBrowser.wait(this.until.presenceOf(ele), timeOut, 'Element ' + xpath +' takes too long to appear in the DOM');
await this.curBrowser.wait(this.until.visibilityOf(ele), timeOut, 'Element '+ xpath +' is not visible');
await ele.sendKeys(data)
}
示例7:
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);
});
示例8: it
it('should show the correct validity state', () => {
expect(statusP.getText()).toEqual('Validation status: VALID');
input.click();
input.clear();
input.sendKeys('a');
expect(statusP.getText()).toEqual('Validation status: INVALID');
});
示例9: it
it('should fill the memory with past results', () => {
first.sendKeys('1');
second.sendKeys('1');
goButton.click();
first.sendKeys('10');
second.sendKeys('20');
goButton.click();
let memory = element.all(by.repeater('result in memory').
column('result.value'));
memory.then((arr) => {
expect(arr.length).toEqual(2);
expect(arr[0].getText()).toEqual('30'); // 10 + 20 = 30
expect(arr[1].getText()).toEqual('2'); // 1 + 1 = 2
},
// TODO: remove optional error fn
() => {});
});