本文整理汇总了TypeScript中selenium-webdriver.Session.getId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Session.getId方法的具体用法?TypeScript Session.getId怎么用?TypeScript Session.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium-webdriver.Session
的用法示例。
在下文中一共展示了Session.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
driver.getSession().then((session: Session) => {
// Fetching BrowserStack session details.
this.browserstackClient.getSession(
session.getId(), function(error: Error, automate_session: any) {
if (error) {
logger.info(
'BrowserStack results available at ' +
'https://www.browserstack.com/automate');
} else {
if (automate_session && automate_session.browser_url) {
logger.info('BrowserStack results available at ' + automate_session.browser_url);
} else {
logger.info(
'BrowserStack results available at ' +
'https://www.browserstack.com/automate');
}
}
});
let jobStatus = update.passed ? 'completed' : 'error';
let statusObj = {status: jobStatus};
// Updating status of BrowserStack session.
this.browserstackClient.updateSession(
session.getId(), statusObj, function(error: Error, automate_session: any) {
if (error) {
throw new BrowserError(
logger, 'Error updating BrowserStack pass/fail status: ' + util.inspect(error));
} else {
logger.info(automate_session);
deferred.resolve();
}
});
});
示例2: Error
driver.getSession().then((session: Session) => {
logger.info('SauceLabs results available at http://saucelabs.com/jobs/' + session.getId());
this.sauceServer_.updateJob(session.getId(), update, (err: Error) => {
if (err) {
throw new Error('Error updating Sauce pass/fail status: ' + util.inspect(err));
}
});
});
示例3: TestSession
function TestSession() {
let session: webdriver.Session = new webdriver.Session('ABC', webdriver.Capabilities.android());
let capabilitiesObj: any = {};
capabilitiesObj[webdriver.Capability.BROWSER_NAME] = webdriver.Browser.ANDROID;
capabilitiesObj[webdriver.Capability.PLATFORM] = 'ANDROID';
session = new webdriver.Session('ABC', capabilitiesObj);
let capabilities: webdriver.Capabilities = session.getCapabilities();
let capability: any = session.getCapability(webdriver.Capability.BROWSER_NAME);
let id: string = session.getId();
let data: string = session.toJSON();
}
示例4: Buffer
driver.getSession().then((session: Session) => {
let headers: Object = {
'Content-Type': 'application/json',
'Authorization': 'Basic ' +
new Buffer(this.config_.browserstackUser + ':' + this.config_.browserstackKey)
.toString('base64')
};
let options = {
hostname: 'www.browserstack.com',
port: 443,
path: '/automate/sessions/' + session.getId() + '.json',
method: 'GET',
headers: headers
};
let req = https.request(options, (res) => {
res.on('data', (data: Buffer) => {
let info = JSON.parse(data.toString());
if (info && info.automation_session && info.automation_session.browser_url) {
logger.info(
'BrowserStack results available at ' + info.automation_session.browser_url);
} else {
logger.info(
'BrowserStack results available at ' +
'https://www.browserstack.com/automate');
}
});
});
req.end();
req.on('error', (e: Error) => {
logger.info(
'BrowserStack results available at ' +
'https://www.browserstack.com/automate');
});
let jobStatus = update.passed ? 'completed' : 'error';
options.method = 'PUT';
let update_req = https.request(options, (res) => {
let responseStr = '';
res.on('data', (data: Buffer) => {
responseStr += data.toString();
});
res.on('end', () => {
logger.info(responseStr);
deferred.resolve();
});
res.on('error', (e: Error) => {
throw new BrowserError(
logger, 'Error updating BrowserStack pass/fail status: ' + util.inspect(e));
});
});
update_req.write('{"status":"' + jobStatus + '"}');
update_req.end();
});