How to use the appium-base-driver.errors.SessionNotCreatedError function in appium-base-driver

To help you get started, we’ve selected a few appium-base-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium / lib / appium.js View on Github external
this.args.denyInsecure.map((a) => log.info(`    ${a}`));
        d.denyInsecure = this.args.denyInsecure;
      }

      if (!_.isEmpty(this.args.allowInsecure)) {
        log.info('Explicitly enabling use of insecure features:');
        this.args.allowInsecure.map((a) => log.info(`    ${a}`));
        d.allowInsecure = this.args.allowInsecure;
      }

      // This assignment is required for correct web sockets functionality inside the driver
      d.server = this.server;
      try {
        runningDriversData = await this.curSessionDataForDriver(InnerDriver);
      } catch (e) {
        throw new errors.SessionNotCreatedError(e.message);
      }
      await pendingDriversGuard.acquire(AppiumDriver.name, () => {
        this.pendingDrivers[InnerDriver.name] = this.pendingDrivers[InnerDriver.name] || [];
        otherPendingDriversData = this.pendingDrivers[InnerDriver.name].map((drv) => drv.driverData);
        this.pendingDrivers[InnerDriver.name].push(d);
      });

      try {
        [innerSessionId, dCaps] = await d.createSession(
          processedJsonwpCapabilities,
          reqCaps,
          processedW3CCapabilities,
          [...runningDriversData, ...otherPendingDriversData]
        );
        protocol = d.protocol;
        await sessionsListGuard.acquire(AppiumDriver.name, () => {
github appium / appium-ios-driver / lib / driver.js View on Github external
async createSession (...args) {
    let [sessionId, caps] = await super.createSession(...args);

    // appium-ios-driver uses Instruments to automate the device
    // but Xcode 8 does not have Instruments, so short circuit
    this.xcodeVersion = await utils.getAndCheckXcodeVersion(this.opts);
    logger.debug(`Xcode version set to ${this.xcodeVersion.versionString}`);
    if (this.xcodeVersion.major >= 8) {
      let msg = `Appium's IosDriver does not support Xcode version ${this.xcodeVersion.versionString}. ` +
                'Apple has deprecated UIAutomation. Use the "XCUITest" automationName capability instead.';
      logger.errorAndThrow(new errors.SessionNotCreatedError(msg));
    }

    // merge server capabilities + desired capabilities
    this.caps = Object.assign({}, defaultServerCaps, this.caps);
    this.caps.desired = caps;

    await utils.detectUdid(this.opts);
    await utils.prepareIosOpts(this.opts);
    this.realDevice = null;
    this.useRobot = this.opts.useRobot;
    this.safari = this.opts.safari;
    this.opts.curOrientation = this.opts.initialOrientation;

    this.sock = path.resolve(this.opts.tmpDir || '/tmp', 'instruments_sock');

    try {