Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@wdio/protocols
Advanced tools
@wdio/protocols is a package that provides WebDriver and Appium protocol bindings for the WebdriverIO framework. It allows you to interact with browser and mobile automation protocols, enabling you to perform a wide range of automation tasks.
WebDriver Protocol
This feature allows you to interact with the WebDriver protocol to automate browser actions. The code sample demonstrates how to initialize a WebDriver session, navigate to a URL, get the page title, and then close the session.
const { WebDriverProtocol } = require('@wdio/protocols');
const session = new WebDriverProtocol({
hostname: 'localhost',
port: 4444,
path: '/wd/hub'
});
session.init({
capabilities: {
browserName: 'chrome'
}
}).then(() => {
return session.url('https://example.com');
}).then(() => {
return session.getTitle();
}).then(title => {
console.log('Page title is:', title);
return session.deleteSession();
}).catch(err => {
console.error('Error:', err);
});
Appium Protocol
This feature allows you to interact with the Appium protocol to automate mobile app actions. The code sample demonstrates how to initialize an Appium session, navigate to a URL within the app, get the app title, and then close the session.
const { AppiumProtocol } = require('@wdio/protocols');
const session = new AppiumProtocol({
hostname: 'localhost',
port: 4723,
path: '/wd/hub'
});
session.init({
capabilities: {
platformName: 'Android',
deviceName: 'emulator-5554',
app: '/path/to/app.apk'
}
}).then(() => {
return session.url('https://example.com');
}).then(() => {
return session.getTitle();
}).then(title => {
console.log('App title is:', title);
return session.deleteSession();
}).catch(err => {
console.error('Error:', err);
});
selenium-webdriver is a popular package for browser automation using the WebDriver protocol. It provides a high-level API for controlling web browsers. Compared to @wdio/protocols, selenium-webdriver is more widely used and has a larger community, but it does not support Appium protocol out of the box.
appium is a package that provides bindings for the Appium protocol, allowing you to automate mobile applications. It is similar to @wdio/protocols in terms of mobile automation capabilities but does not include WebDriver protocol bindings.
This package stores the definition for various automation protocols such as WebDriver or vendor specific protocol extensions like for SauceLabs. Unless you are interested in generating a WebDriver client there should be no reason why you should need this package. This package holds the definition of the following protocols:
To install the package, run:
npm install @wdio/protocols
You can get data by importing the package as follows:
import { WebDriverProtocol, MJsonWProtocol, AppiumProtocol, ChromiumProtocol, SauceLabsProtocol, SeleniumProtocol } from '@wdio/protocols'
/**
* get description of session command
*/
console.log(WebDriverProtocol['/session'].POST.description)
The package exposes TypeScript interfaces for all protocols. You can use them for your own project as follows:
import type { WebDriverCommands } from '@wdio/protocol'
import { WebDriverCommands, WebDriverCommandsAsync } from './src'
const browser = {} as WebDriverCommands
browser.sendAlertText(true)
// fails with "Argument of type 'boolean' is not assignable to parameter of type 'string'.ts(2345)"
const asyncBrowser = {} as WebDriverCommandsAsync
const a = await asyncBrowser.getTitle()
type foo = typeof a // string
For more information on WebdriverIO see the homepage.
v9.0.8 (2024-09-05)
wdio-protocols
, webdriverio
webdriverio
eslint-plugin-wdio
, wdio-allure-reporter
, wdio-appium-service
, wdio-browser-runner
, wdio-browserstack-service
, wdio-cli
, wdio-concise-reporter
, wdio-config
, wdio-cucumber-framework
, wdio-dot-reporter
, wdio-firefox-profile-service
, wdio-globals
, wdio-jasmine-framework
, wdio-junit-reporter
, wdio-lighthouse-service
, wdio-local-runner
, wdio-logger
, wdio-mocha-framework
, wdio-repl
, wdio-reporter
, wdio-runner
, wdio-sauce-service
, wdio-shared-store-service
, wdio-smoke-test-cjs-service
, wdio-smoke-test-reporter
, wdio-smoke-test-service
, wdio-spec-reporter
, wdio-static-server-service
, wdio-sumologic-reporter
, wdio-testingbot-service
, wdio-types
, wdio-utils
, wdio-webdriver-mock-service
, webdriver
, webdriverio
wdio-browser-runner
wdio-shared-store-service
addInitScript
example in v9 blog post (@Mr0grog)FAQs
Utility package providing information about automation protocols
The npm package @wdio/protocols receives a total of 1,584,378 weekly downloads. As such, @wdio/protocols popularity was classified as popular.
We found that @wdio/protocols demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.