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

webdriver

Package Overview
Dependencies
Maintainers
3
Versions
483
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webdriver

A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol

  • 9.0.0-alpha.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
increased by3.9%
Maintainers
3
Weekly downloads
 
Created

What is webdriver?

The 'webdriver' npm package is an HTTP client for interacting with WebDriver-compatible browsers for the purpose of performing automated web application testing. It allows you to control a browser programmatically and perform actions like navigating to URLs, interacting with web page elements, and executing JavaScript within the context of the browser.

What are webdriver's main functionalities?

Browser Navigation

This code sample demonstrates how to navigate to a URL using the webdriver package. It initializes a new browser session, navigates to 'https://example.com', and then closes the session.

const { remote } = require('webdriverio');

(async () => {
  const browser = await remote({
    capabilities: { browserName: 'chrome' }
  });

  await browser.url('https://example.com');

  await browser.deleteSession();
})();

Element Interaction

This code sample shows how to interact with web page elements. It finds an input field and a button by their selectors, sets a value in the input field, and clicks the button.

const { remote } = require('webdriverio');

(async () => {
  const browser = await remote({
    capabilities: { browserName: 'chrome' }
  });

  await browser.url('https://example.com');
  const input = await browser.$('input#search');
  await input.setValue('WebdriverIO');
  const button = await browser.$('button#submit');
  await button.click();

  await browser.deleteSession();
})();

Executing JavaScript

This code sample illustrates executing custom JavaScript code in the context of the browser. It retrieves and logs the title of the current web page.

const { remote } = require('webdriverio');

(async () => {
  const browser = await remote({
    capabilities: { browserName: 'chrome' }
  });

  await browser.url('https://example.com');
  const result = await browser.execute(() => {
    return document.title;
  });
  console.log('Document title is: ' + result);

  await browser.deleteSession();
})();

Other packages similar to webdriver

Keywords

FAQs

Package last updated on 17 Mar 2024

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