當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Session.getId方法代碼示例

本文整理匯總了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();
              }
            });
      });
開發者ID:DylanLacey,項目名稱:protractor,代碼行數:35,代碼來源:browserStack.ts

示例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));
     }
   });
 });
開發者ID:jan-molak,項目名稱:protractor,代碼行數:8,代碼來源:sauce.ts

示例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();
}
開發者ID:Rick-Kirkham,項目名稱:DefinitelyTyped,代碼行數:12,代碼來源:index.ts

示例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();
      });
開發者ID:MexicanAce,項目名稱:protractor,代碼行數:53,代碼來源:browserStack.ts


注:本文中的selenium-webdriver.Session.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。