{"name":"webdriver","version":"7.40.0","keywords":["webdriver"],"author":{"name":"Christian Bromann","email":"mail@bromann.dev"},"license":"MIT","_id":"webdriver@7.40.0","homepage":"https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver","bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"dist":{"shasum":"b02f55a8a2f607a3e256e1ffd9e23e4d4ba63b0e","tarball":"http://registry-npm.ywwl.com/webdriver/download/webdriver-7.40.0.tgz","fileCount":30,"integrity":"sha512-CKi3cDWgNVE/ibcsBfdtA+pQVeZ4oYlecLlwemulVxJdgr4l5bv+nXuoIhnYeVb6aAI4naK772vmWQ0XuRYhDQ==","signatures":[{"sig":"MEUCIQCqXtMXCD0atZE8M9IjEVfl06V+0hl/qKlscQVfPnLixwIgBpYTg3J8SB26HGgqdE1YoqFSJtWIrWcR2bzlG+gGjQk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":67331,"size":18813,"noattachment":false,"key":"/webdriver/-/webdriver-7.40.0.tgz"},"main":"./build","types":"./build/index.d.ts","engines":{"node":">=12.0.0"},"gitHead":"6d44a39b17edb7c45c88a780bf1dbefe388550fb","_npmUser":{"name":"wdio-user","email":"bot@webdriver.io"},"repository":{"url":"git://github.com/webdriverio/webdriverio.git","type":"git"},"_npmVersion":"lerna/6.6.2/node@v18.20.5+x64 (linux)","description":"A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol","directories":{},"_nodeVersion":"18.20.5","dependencies":{"ky":"0.30.0","got":"^11.0.2","@types/node":"^18.0.0","@wdio/types":"7.40.0","@wdio/utils":"7.40.0","@wdio/config":"7.40.0","@wdio/logger":"7.26.0","lodash.merge":"^4.6.1","@wdio/protocols":"7.27.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@types/lodash.merge":"^4.6.6"},"typeScriptVersion":"3.8.3","_npmOperationalInternal":{"tmp":"tmp/webdriver_7.40.0_1734539505547_0.9321047367835522","host":"s3://npm-registry-packages-npm-production"},"readme":"WebDriver\n=========\n\n> A lightweight, non-opinionated implementation of the [WebDriver](https://w3c.github.io/webdriver/webdriver-spec.html) and [WebDriver BiDi](https://w3c.github.io/webdriver-bidi/) specification including mobile commands supported by [Appium](http://appium.io/)\n\nThere are [tons](https://github.com/christian-bromann/awesome-selenium#javascript) of Selenium and WebDriver binding implementations in the Node.js world. Every one of them has an opinionated API and recommended way to use it. This binding is the most non-opinionated you will find as it just represents the [WebDriver specification](https://w3c.github.io/webdriver/webdriver-spec.html) and doesn't come with any extra or higher-level abstraction. It is lightweight and comes with support for the [WebDriver specification](https://w3c.github.io/webdriver/webdriver-spec.html) and [Appium](https://appium.io/).\n\nThe package supports the following protocols:\n\n- [WebDriver](https://w3c.github.io/webdriver/)\n- [WebDriver Bidi](https://w3c.github.io/webdriver-bidi/)\n- [Appium](http://appium.io/)\n- [Chromium](http://chromedriver.chromium.org/) (additional Chromedriver specific commands)\n- [Selenium](https://www.selenium.dev/) (additional Selenium WebDriver specific commands)\n- [Sauce Labs](https://saucelabs.com/) (Sauce Labs specific WebDriver extensions)\n\nCommands are added to the client's protocol based on assumptions of provided capabilities. You can find more details about the commands by checking out the [`@wdio/protocols`](https://www.npmjs.com/package/@wdio/protocols) package. All commands come with TypeScript support.\n\n## Install\n\nTo install this package from NPM run:\n\n```sh\nnpm i webdriver\n```\n\n## WebDriver Example\n\nThe following example demonstrates a simple Google Search scenario:\n\n```js\nimport WebDriver from 'webdriver';\n\nconst client = await WebDriver.newSession({\n    path: '/',\n    capabilities: { browserName: 'firefox' }\n})\n\nawait client.navigateTo('https://www.google.com/ncr')\n\nconst searchInput = await client.findElement('css selector', '#lst-ib')\nawait client.elementSendKeys(searchInput['element-6066-11e4-a52e-4f735466cecf'], 'WebDriver')\n\nconst searchBtn = await client.findElement('css selector', 'input[value=\"Google Search\"]')\nawait client.elementClick(searchBtn['element-6066-11e4-a52e-4f735466cecf'])\n\nconsole.log(await client.getTitle()) // outputs \"WebDriver - Google Search\"\n\nawait client.deleteSession()\n```\n\n## WebDriver Bidi Example\n\nTo connect to the WebDriver Bidi protocol you have to send along a `webSocketUrl` flag to tell the browser driver to opt-in to the protocol:\n\n```js\nimport WebDriver from 'webdriver'\n\nconst browser = await WebDriver.newSession({\n    capabilities: {\n        webSocketUrl: true,\n        browserName: 'firefox'\n    }\n})\n\nawait browser.sessionSubscribe({ events: ['log.entryAdded'] })\n\n/**\n * returns: {\"type\":\"console\",\"method\":\"log\",\"realm\":null,\"args\":[{\"type\":\"string\",\"value\":\"Hello Bidi\"}],\"level\":\"info\",\"text\":\"Hello Bidi\",\"timestamp\":1657282076037}\n */\nbrowser.on('log.entryAdded', (entryAdded) => console.log('received %s', entryAdded))\n\nawait browser.executeScript('console.log(\"Hello Bidi\")', [])\nawait browser.deleteSession()\n```\n\n# Configuration\n\nTo create a WebDriver session call the `newSession` method on the `WebDriver` class and pass in your configurations:\n\n```js\nimport WebDriver from 'webdriver'\nconst client = await WebDriver.newSession(options)\n```\n\nThe following options are available:\n\n### capabilities\n\n<Option type=\"Object\">\n\nDefines the [capabilities](https://w3c.github.io/webdriver/webdriver-spec.html#capabilities) you want to run in your WebDriver session. Note: by default, it will automatically set the `webSocketUrl` to establish a [WebDriver Bidi](https://w3c.github.io/webdriver-bidi/) session, if you don't want this, make sure to set `'wdio:enforceWebDriverClassic': true` in your capabilities.\n\n</Option>\nRequired: `true`\n\n### logLevel\n\n<Option type=\"String\" default=\"info\" values=\"trace | debug | info | warn | error | silent\">\n\nLevel of logging verbosity.\n\n</Option>\n\n### protocol\n\n<Option type=\"String\" default=\"http\" values=\"http | https\">\n\nProtocol to use when communicating with the Selenium standalone server (or driver).\n\n</Option>\n\n### hostname\n\n<Option type=\"String\" default=\"localhost\">\n\nHost of your WebDriver server.\n\n</Option>\n\n### port\n\n<Option type=\"Number\" default=\"undefined\">\n\nPort your WebDriver server is on.\n\n</Option>\n\n### path\n\n<Option type=\"String\" default=\"/\">\n\nPath to WebDriver endpoint or grid server.\n\n</Option>\n\n### queryParams\n\n<Option type=\"Object\" default=\"undefined\">\n\nQuery parameters that are propagated to the driver server.\n\n</Option>\n\n### connectionRetryTimeout\n\n<Option type=\"Number\" default=\"120000\">\n\nTimeout for any WebDriver request to a driver or grid.\n\n</Option>\n\n### connectionRetryCount\n\n<Option type=\"Number\" default=\"3\">\n\nCount of request retries to the Selenium server.\n\n</Option>\n\n### bidiResponseTimeout\n\n<Option type=\"Number\" default=\"180000\">\n\nTimeout (in ms) for a WebDriver Bidi command to receive a response from the browser. Increase this if you run commands, e.g. `execute`, that legitimately take longer than the default to resolve.\n\n</Option>\n\n### agent\n\n<Option type=\"Object\" default={`{\n    http: new http.Agent({ keepAlive: true }),\n    https: new https.Agent({ keepAlive: true })\n}`}>\n\nAllows you to use a custom` http`/`https`/`http2` [agent](https://www.npmjs.com/package/got#agent) to make requests.\n\n</Option>\n\n### transformRequest\n\n<Option type=\"(RequestOptions) => RequestOptions\" default=\"none\">\n\nFunction intercepting [HTTP request options](https://github.com/sindresorhus/got#options) before a WebDriver request is made to a driver.\n\n</Option>\n\n### transformResponse\n\n<Option type=\"(Response, RequestOptions) => Response\" default=\"none\">\n\nFunction intercepting HTTP response objects after a WebDriver response has arrived.\n\n</Option>\n\n","publish_time":1734539505794,"maintainers":[{"name":"christian-bromann","email":"mail@bromann.dev"},{"name":"wdio-user","email":"bot@webdriver.io"},{"name":"wswebcreation-nl","email":"wim@wswebcreation.nl"}],"_cnpm_publish_time":1734539505794,"dist-tags":{"alpha":"5.0.0-alpha.14","beta":"7.0.0-beta.4","latest":"10.2.0","latest-5":"5.23.0","next":"10.2.0-alpha.100.sha-b38abd894","v7":"7.40.0","v8":"8.46.0","v9":"9.33.1"}}