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