Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Philipp Partosch 46a936d7de added all files to project 2 years ago
..
build added all files to project 2 years ago
node_modules added all files to project 2 years ago
README.md added all files to project 2 years ago
package.json added all files to project 2 years ago
webdriver.d.ts added all files to project 2 years ago

README.md

WebDriver

A lightweight, non-opinionated implementation of the WebDriver specification including mobile commands supported by Appium

There are tons of Selenium and WebDriver binding implementations in the Node.js world. Every one of them have an opinionated API and recommended way to use. This binding is the most non-opinionated you will find as it just represents the WebDriver specification and doesn’t come with any extra or higher level abstraction. It is lightweight and comes with support for the WebDriver specification and Appium’s Mobile JSONWire Protocol.

Install

To install this package from NPM run:

$ npm i webdriver

Example

The following example demonstrates a simple Google Search scenario:

import WebDriver from 'webdriver';

(async () => {
    const client = await WebDriver.newSession({
        path: '/',
        capabilities: { browserName: 'firefox' }
    })

    await client.navigateTo('https://www.google.com/ncr')

    const searchInput = await client.findElement('css selector', '#lst-ib')
    await client.elementSendKeys(searchInput['element-6066-11e4-a52e-4f735466cecf'], 'WebDriver')

    const searchBtn = await client.findElement('css selector', 'input[value="Google Search"]')
    await client.elementClick(searchBtn['element-6066-11e4-a52e-4f735466cecf'])

    console.log(await client.getTitle()) // outputs "WebDriver - Google Search"

    await client.deleteSession()
})()

Configuration

To create a WebDriver session call the newSession method on the WebDriver class and pass in your configurations:

import WebDriver from 'webdriver'
const client = await WebDriver.newSession(options)

The following options are available:

capabilities

Defines the capabilities you want to run in your Selenium session.

Type: Object
Required: true

logLevel

Level of logging verbosity.

Type: String
Default: info
Options: trace | debug | info | warn | error | silent

protocol

Protocol to use when communicating with the Selenium standalone server (or driver).

Type: String
Default: http Options: http | https

hostname

Host of your WebDriver server.

Type: String
Default: localhost

port

Port your WebDriver server is on.

Type: Number
Default: 4444

path

Path to WebDriver endpoint or grid server.

Type: String
Default: /

queryParams

Query parameters that are propagated to the driver server.

Type: Object Default: null

connectionRetryTimeout

Timeout for any WebDriver request to a driver or grid.

Type: Number
Default: 120000

connectionRetryCount

Count of request retries to the Selenium server.

Type: Number
Default: 2

agent

Allows you to use a customhttp/https/http2 agent to make requests.

Type: Object
Default:

{
    http: new http.Agent({ keepAlive: true }),
    https: new https.Agent({ keepAlive: true })
}

transformRequest

Function intercepting HTTP request options before a WebDriver request is made

Type: (RequestOptions) => RequestOptions
Default: none

transformResponse

Function intercepting HTTP response objects after a WebDriver response has arrived

Type: (Response, RequestOptions) => Response
Default: none