当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript selenium-webdriver.Session类代码示例

本文整理汇总了TypeScript中selenium-webdriver.Session的典型用法代码示例。如果您正苦于以下问题:TypeScript Session类的具体用法?TypeScript Session怎么用?TypeScript Session使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Session类的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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。