本文整理汇总了TypeScript中protractor.browser.driver.switchTo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript browser.driver.switchTo方法的具体用法?TypeScript browser.driver.switchTo怎么用?TypeScript browser.driver.switchTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protractor.browser.driver
的用法示例。
在下文中一共展示了browser.driver.switchTo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should emit checkedChange event when change the checked state', async () => {
const switchEl = element(by.id('test-switch1'));
switchEl.click();
const alert = browser.driver.switchTo().alert();
expect(alert.getText()).toBe('switch message is: true');
alert.dismiss();
await browser.wait(ExpectedConditions.not(ExpectedConditions.alertIsPresent()));
switchEl.click();
expect(browser.driver.switchTo().alert().getText()).toBe('switch message is: false');
alert.dismiss();
});
示例2:
return element.getText().then(elementText => {
return browser.driver.switchTo().activeElement().getText().then(activeText => {
return activeText === elementText;
});
});
示例3:
browser.driver.getAllWindowHandles().then((handles) => {
browser.waitForAngularEnabled();
browser.driver.switchTo().window(handles[windowNumber]);
});
示例4:
return elements.map(async el => {
const elementText = await el!.getText();
const activeText = await browser.driver.switchTo().activeElement().getText();
return activeText === elementText;
});
示例5: expectFocusOn
export function expectFocusOn(element: FinderResult, expected = true): void {
expect(browser.driver.switchTo().activeElement().getId()).toBe(
getElement(element).getId(), `Expected element${expected ? '' : ' not'} to be focused.`);
}
示例6: async
export const sendKey = async(...keys: string[]) => {
const focused = await browser.driver.switchTo().activeElement();
await focused.sendKeys(Key.chord(...keys));
};
示例7: expectFocusOn
// TODO(crisbeto): should be moved to a common util. copied from the menu e2e setup.
function expectFocusOn(el: any): void {
expect(browser.driver.switchTo().activeElement().getInnerHtml()).toBe(el.getInnerHtml());
}
示例8:
return elements.map(async (element) => {
let elementText = await element.getText();
let activeText = await browser.driver.switchTo().activeElement().getText();
return activeText === elementText;
});