本文整理匯總了TypeScript中protractor.by.addLocator方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript by.addLocator方法的具體用法?TypeScript by.addLocator怎麽用?TypeScript by.addLocator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類protractor.by
的用法示例。
在下文中一共展示了by.addLocator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
/// <reference path="../../built/index.d.ts" />
import {by, By} from 'protractor';
by.addLocator(0, () => {});
by.addLocator(() => {}, () => {});
by.addLocator('', () => {}, () => {});
by.addLocator('', '', '');
by.binding(0);
by.binding(true);
by.binding(() => {});
by.binding();
by.binding('', '');
by.exactBinding(0);
by.exactBinding(true);
by.exactBinding(() => {});
by.exactBinding();
by.exactBinding('', '');
by.model(0);
by.model(true);
by.model(() => {});
by.model();
by.model('', '');
by.buttonText(0);
by.buttonText(true);
by.buttonText(() => {});
by.buttonText();
by.buttonText('', '');
by.partialButtonText(0);
by.partialButtonText(true);
by.partialButtonText(() => {});
by.partialButtonText();
by.partialButtonText('', '');
示例2: deleteFirstListItem
import { browser, by, element, ElementFinder } from 'protractor';
import { Element } from '@angular/compiler';
by.addLocator(
'formControlName',
(value: string, opt_parentElement: HTMLElement, opt_rootSelector: HTMLElement) => {
const using = opt_parentElement || document;
return using.querySelectorAll(`[formControlName="${value}"]`);
}
);
export class AppPage {
navigateToHeroes() {
return browser.get('/heroes?e2e');
}
navigateToVillains() {
return browser.get('/villains?e2e');
}
async deleteFirstListItem() {
const firstDeleteButton = this.getFirstDeleteButton();
await firstDeleteButton.click();
}
getToolbarLinks() {
return element.all(by.css('mat-toolbar a[routerlinkactive]'));
}
getActiveLink() {
示例3:
browser.navigate();
browser.setLocation('url');
browser.getLocationAbsUrl();
browser.debugger();
browser.enterRepl();
browser.enterRepl(100);
browser.pause();
browser.pause(100);
browser.actions();
browser.wait('condition');
browser.wait('condition', 100);
browser.wait('condition', 100, 'message');
browser.getCurrentUrl();
browser.getTitle();
browser.takeScreenshot();
by.addLocator('name', () => {});
by.addLocator('name', 'script');
by.binding('bindingDescriptor');
by.exactBinding('bindingDescriptor');
by.model('model');
by.buttonText('searchText');
by.partialButtonText('searchText');
by.repeater('repeatDescriptor');
by.exactRepeater('repeatDescriptor');
by.cssContainingText('cssSelector', 'searchText');
by.options('optionsDescriptor');
by.deepCss('selector');
by.className('className');
by.css('css');
by.id('id');
by.linkText('linkText');