本文整理匯總了TypeScript中protractor.browser.getCapabilities方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript browser.getCapabilities方法的具體用法?TypeScript browser.getCapabilities怎麽用?TypeScript browser.getCapabilities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類protractor.browser
的用法示例。
在下文中一共展示了browser.getCapabilities方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: afterEach
afterEach(function (done) {
browser.getCapabilities()
.then(function (capabilities) {
if (capabilities.get('browserName') !== 'firefox') {
browser.manage().logs().get('browser').then(done, done.fail);
browser.waitForAngular();
} else {
done();
}
});
});
示例2: beforeEach
beforeEach(async () => {
browser.waitForAngularEnabled(false)
videoWatchPage = new VideoWatchPage()
pageUploadPage = new VideoUploadPage()
loginPage = new LoginPage()
const caps = await browser.getCapabilities()
isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true
isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
})
示例3: afterEach
/**
* An example 'after' hook that will be run after every scenario.
*/
@after()
private async afterEach(scenario: HookScenarioResult) {
let success = scenario.result.status === Status.PASSED ? 'successfully' : 'unsuccessfully';
console.log(`The scenario '${scenario.pickle.name}' has completed ${success}`);
// Taking a screenshot of the browser if the scenario has failed.
if (scenario.result.status === Status.FAILED) {
let screenshot = await browser.takeScreenshot();
let browserName = (await browser.getCapabilities()).get('browserName');
let filename = browserName + ' FAIL - ' + scenario.pickle.name + '.png';
Utils.writeScreenshot(screenshot, filename)
}
}
示例4: before
before(() => {
// https://git.io/vKHN1
browser.getCapabilities().then(capabilities => {
browserName = capabilities.get('browserName');
if (browserName !== 'chrome') {
let chkOnDismiss = $('input[ng-model="ondismiss.should"]');
let txtMessage = $('input[ng-model="message"]');
txtMessage.clear();
txtMessage.sendKeys(msgText);
chkOnDismiss.getAttribute('checked').then(isChecked => {
if (!isChecked) {
chkOnDismiss.click();
}
});
element(by.buttonText('Add to Custom Stack')).click();
}
});
});