{"name":"webdriver","version":"9.6.2","keywords":["webdriver"],"author":"Christian Bromann <mail@bromann.dev>","license":"MIT","_id":"webdriver@9.6.2","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":"65c5564dcf556656b9f48db99a0a6cc39c01e6ec","tarball":"http://registry-npm.ywwl.com/webdriver/download/webdriver-9.6.2.tgz","fileCount":46,"integrity":"sha512-NcA1xTtK1DVQ+7H3Xq8GZcUiTQANUelt2yfUDcYGdOoIEypvsDYMPx340LndOBIRNfln+ZGMsByhHF+1mWI/Rw==","signatures":[{"sig":"MEQCIHS3k04L9JP6vU2kfVCjOTEScxAcO7AhwxnLBRKU2McFAiA/4sX8I+NMCP8Vbf9q8MfKmWNI2mu6vAa/o2zNbUk+qQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":302749,"size":57849,"noattachment":false,"key":"/webdriver/-/webdriver-9.6.2.tgz"},"main":"./build/index.cjs","type":"module","types":"./build/index.d.ts","module":"./build/index.js","engines":{"node":">=18.20.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/node.js","browser":"./build/index.js","require":"./build/index.cjs","importSource":"./src/node.ts","browserSource":"./src/browser.js","requireSource":"./src/index.cts"}},"gitHead":"918477b20c54c27b98655b08f55a2a304495f0fa","_npmUser":{"name":"wdio-user","email":"bot@webdriver.io"},"repository":{"url":"git+https://github.com/webdriverio/webdriverio.git","type":"git","directory":"packages/webdriver"},"_npmVersion":"lerna/8.1.9/node@v20.11.1+x64 (linux)","description":"A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol","directories":{},"_nodeVersion":"20.11.1","dependencies":{"ws":"^8.8.0","undici":"^6.20.1","@types/ws":"^8.5.3","@types/node":"^20.1.0","@wdio/types":"9.6.2","@wdio/utils":"9.6.2","@wdio/config":"9.6.2","@wdio/logger":"9.4.4","deepmerge-ts":"^7.0.3","@wdio/protocols":"9.4.4"},"_hasShrinkwrap":false,"typeScriptVersion":"3.8.3","_npmOperationalInternal":{"tmp":"tmp/webdriver_9.6.2_1737665777179_0.7566137032324252","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":1737665777348,"_cnpm_publish_time":1737665777348,"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"}}