Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@appium/base-driver

Package Overview
Dependencies
Maintainers
7
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appium/base-driver

Base driver class for Appium drivers

  • 9.3.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
311K
decreased by-21.38%
Maintainers
7
Weekly downloads
 
Created

What is @appium/base-driver?

@appium/base-driver is a foundational package for creating Appium drivers. It provides a base class and a set of utilities that can be extended to create custom drivers for different platforms and automation needs.

What are @appium/base-driver's main functionalities?

BaseDriver Class

The BaseDriver class provides the core functionality for creating and managing sessions. By extending this class, you can implement custom logic for session creation and deletion.

const { BaseDriver } = require('@appium/base-driver');

class CustomDriver extends BaseDriver {
  async createSession(capabilities) {
    // Custom session creation logic
    return super.createSession(capabilities);
  }

  async deleteSession() {
    // Custom session deletion logic
    return super.deleteSession();
  }
}

module.exports = CustomDriver;

Command Handling

Command handling allows you to define custom endpoints and their corresponding logic. This is useful for implementing specific commands that your driver needs to support.

const { BaseDriver } = require('@appium/base-driver');

class CustomDriver extends BaseDriver {
  constructor(opts) {
    super(opts);
    this.handlers = {
      '/session/:sessionId/element': this.findElement.bind(this),
      // Add more command handlers here
    };
  }

  async findElement(sessionId, params) {
    // Custom element finding logic
    return { ELEMENT: 'element-id' };
  }
}

module.exports = CustomDriver;

Proxying Commands

Proxying commands allows your driver to forward requests to another server. This is useful for scenarios where your driver needs to interact with an existing WebDriver server.

const { BaseDriver } = require('@appium/base-driver');

class CustomDriver extends BaseDriver {
  constructor(opts) {
    super(opts);
    this.proxyReqRes = true; // Enable proxying
  }

  async proxyCommand(url, method, body) {
    // Custom proxy logic
    return await this.jwproxy.command(url, method, body);
  }
}

module.exports = CustomDriver;

Other packages similar to @appium/base-driver

Keywords

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc