{"name":"webdriver","version":"8.45.0","keywords":["webdriver"],"author":"Christian Bromann <mail@bromann.dev>","license":"MIT","_id":"webdriver@8.45.0","maintainers":[{"name":"christian-bromann","email":"mail@bromann.dev"},{"name":"wdio-user","email":"bot@webdriver.io"},{"name":"wswebcreation-nl","email":"wim@wswebcreation.nl"}],"homepage":"https://github.com/webdriverio/webdriverio/tree/main/packages/webdriver","bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"dist":{"shasum":"256d58c5efa015ea73aacbf69c094cfdb59438aa","tarball":"http://registry-npm.ywwl.com/webdriver/download/webdriver-8.45.0.tgz","fileCount":47,"integrity":"sha512-guPEo1HeZ+4gvdvgMvnFpjTdqQ5SHkE7PKzWqhnDlSl6uhkFyiwSTt+77pgFLvjEPWesr3lpSTkvhyKQ8+Ov+g==","signatures":[{"sig":"MEUCIFDG23QfQ/8kTD6t8PSpXGrk2WRFKk+X1oJBgszg5sCrAiEAh2ag55LUdP52EiFZ0xzNp7wJ/JTniDs4HLFaJiDVW3w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/webdriver@8.45.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":208719,"size":39475,"noattachment":false,"key":"/webdriver/-/webdriver-8.45.0.tgz"},"main":"./build/cjs/index.js","type":"module","types":"./build/index.d.ts","module":"./build/index.js","engines":{"node":"^16.13 || >=18"},"exports":{".":[{"types":"./build/index.d.ts","import":"./build/index.js","require":"./build/cjs/index.js"},"./build/cjs/index.js"],"./package.json":"./package.json"},"gitHead":"7836fbee7a85a16f2b7faa592969f914c504ba8a","_npmUser":{"name":"wdio-user","email":"bot@webdriver.io"},"repository":{"url":"git://github.com/webdriverio/webdriverio.git","type":"git","directory":"packages/webdriver"},"_npmVersion":"lerna/8.1.9/node@v18.20.8+x64 (linux)","description":"A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol","directories":{},"_nodeVersion":"18.20.8","dependencies":{"ky":"^0.33.0","ws":"^8.8.0","got":"^12.6.1","@types/ws":"^8.5.3","@types/node":"^22.2.0","@wdio/types":"8.41.0","@wdio/utils":"8.45.0","@wdio/config":"8.45.0","@wdio/logger":"8.38.0","deepmerge-ts":"^5.1.0","@wdio/protocols":"8.44.0"},"_hasShrinkwrap":false,"typeScriptVersion":"3.8.3","_npmOperationalInternal":{"tmp":"tmp/webdriver_8.45.0_1749746282632_0.8716237179957125","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":1749746282833,"_cnpm_publish_time":1749746282833,"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"}}