{"name":"@wdio/session","version":"10.0.2","keywords":["webdriverio","wdio","session","cli","agent","automation"],"author":{"name":"Christian Bromann","email":"mail@bromann.dev"},"license":"MIT","_id":"@wdio/session@10.0.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/wdio-session","bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"bin":{"wdio-session":"bin/wdio-session.js"},"dist":{"shasum":"f9771a66c25d3f8c8ccf3b1450c19913b07de2d7","tarball":"http://registry-npm.ywwl.com/@wdio/session/download/@wdio/session-10.0.2.tgz","fileCount":154,"integrity":"sha512-Ttu2425dZ+r5whjScFRWVkAHAyhg/5nheN/bkTWPf2gluJb4/na2NM7bElOZ4IZFgwFgM5gFkE+9o5WwSVJfSQ==","signatures":[{"sig":"MEUCIEUvO9HV0OQjSa5W0yV15AhNfcjUDESIgh73NBQidfgpAiEA5zIj8zIotYyM700mxAiiQRz2rkBmPu/WILANLnlSOuQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIE907M1aGDbYQKy+6aDaaduwtvsMDGPZhPOZMhsKLDcMAiEAnNLEbWCFcV4mSCqwMBljVVfhBj5rsEQKUkc8ehCNt2k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@wdio%2fsession@10.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1526697,"size":403773,"noattachment":false,"key":"/@wdio/session/-/@wdio/session-10.0.2.tgz"},"type":"module","types":"./build/index.d.ts","engines":{"node":">=22.19.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/index.js"},"./cli":{"types":"./build/cli.d.ts","import":"./build/cli.js","source":"./src/cli.ts"},"./agent":{"types":"./build/agent.d.ts","import":"./build/agent.js","source":"./src/agent.ts"},"./daemon":{"import":"./build/daemon.js","source":"./src/daemon/main.ts"},"./package.json":"./package.json"},"gitHead":"f256375e1426e3607ae9a539ffc1117191b0d097","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"627c91ac-103b-4373-a2ae-ddf63f5e0b7c"}},"repository":{"url":"git+https://github.com/webdriverio/webdriverio.git","type":"git","directory":"packages/wdio-session"},"_npmVersion":"lerna/9.0.7/node@v24.21.0+x64 (linux)","description":"Drive browsers, mobile apps and desktop apps with WebdriverIO from the shell","directories":{},"_nodeVersion":"24.21.0","dependencies":{"acorn":"^8.15.0","yargs":"^18.2.0","semver":"^7.7.4","get-port":"^7.1.0","picomatch":"^4.0.7","image-size":"^2.0.4","@types/node":"^22.20.4","@wdio/types":"10.0.1","@wdio/utils":"10.0.1","webdriverio":"10.0.2","@wdio/config":"10.0.1","@wdio/logger":"10.0.0","@wdio/snapshot":"10.0.2","@wdio/display-server":"10.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.15","@types/yargs":"^17.0.33","@types/semver":"^7.5.8","@types/picomatch":"^4.0.2","expect-webdriverio":"^8.0.0-alpha.3"},"peerDependencies":{"tsx":"*","appium":"^3.0.0","expect-webdriverio":"*","@wdio/visual-service":"*","@wdio/electron-service":"*"},"typeScriptVersion":"6.0.3","peerDependenciesMeta":{"tsx":{"optional":true},"appium":{"optional":true},"expect-webdriverio":{"optional":true},"@wdio/visual-service":{"optional":true},"@wdio/electron-service":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/session_10.0.2_1791478998686_0.2613321645821105","host":"s3://npm-registry-packages-npm-production"},"readme":"WebdriverIO Session\n===================\n\n> Drive browsers, mobile apps and desktop apps with WebdriverIO from the shell.\n\n`wdio session` starts a WebdriverIO session that outlives the command that\ncreated it, so a coding agent (or a human) can automate an app with many short\nshell commands and turn what worked into a test.\n\n```sh\nnpx wdio session open chrome http://localhost:3000\nnpx wdio session snapshot\nnpx wdio session click e3\nnpx wdio session <<'JS'\nawait expect($('aria/Cart (1)')).toBeDisplayed()\nJS\nnpx wdio session export --out test/specs/cart.e2e.ts\nnpx wdio session close\n```\n\nThe command is part of `@wdio/cli`. `npx wdio` installs the unscoped\n[`wdio`](https://www.npmjs.com/package/wdio) package, which runs that CLI, so\nyou do not install `@wdio/session` or `@wdio/cli` first. For the full guide, see\n[webdriver.io/docs/session](https://webdriver.io/docs/session).\nCheck a machine with `npx wdio session doctor`. Agents install the skill with\n`npx wdio session skill --install .`.\n\n## Use the actions from code\n\nInstall `webdriverio` next to this package: it is a required peer dependency.\n\n`@wdio/session/agent` runs the same actions, snapshots and refs on a browser\nyour code already owns, for example in a test or a `remote()` script. There is\nno daemon. `dispose()` leaves the browser session open.\n\n> **Experimental:** the `@wdio/session/agent` API, the snapshot text and the\n> `RefEntry` fields `ref()` returns may change in a minor release. The ref\n> syntax (`e3`) and the code an action records stay stable.\n\n```ts\nimport { remote } from 'webdriverio'\nimport { createAgentSession } from '@wdio/session/agent'\n\nconst browser = await remote({ capabilities: { browserName: 'chrome' } })\nconst agent = await createAgentSession(browser, { captureEvents: true })\n\nawait browser.url('http://localhost:3000')\nconst { text } = await agent.snapshot({ interactive: true })\nconst { code } = await agent.run('click', { target: 'e3' })\nconsole.log(code) // await $('role/button[name=\"Add to cart\"]').click()\n\nawait agent.dispose()\nawait browser.deleteSession()\n```\n\n`run(action, args)` type-checks the action name and its arguments against the\naction specs: positionals and options are camelCased (`--max-chars` becomes\n`maxChars`) and a variadic positional is one string. A typo is a compile error.\nUse `runAction(name, args)` when the name is only known at runtime, for example\nfrom a recorded step. It takes untyped arguments.\n\n`snapshot(opts)` returns an `AgentSnapshot`: `text`, the `tree`, and the\n`lines`, `refs` and `chars` counts, plus `page` and `notes` when there are any.\n`maxChars` caps the size. Above it `tooBig` is `true` and `text` is a summary.\nIt writes no file and works for app (Appium) sessions too.\n\nAction results carry structured fields next to `text` and `code`:\n\n- `changes`: what the page shows after the action, a `PageChange` of kind\n  `page` (a navigation or new frame), `changed` (added elements) or `removed`.\n- `noVisibleChange`: `true` after a click or tap that changed nothing.\n- `page` and `notes`: the URL and title, and load-error or bot-check notes.\n- `data`: typed per action, for example `get` gives `{ text, value, ... }`.\n\nHints in the output name `wdio session` commands. The `hint` option rewrites\nthem for your own tools. Return `undefined` to keep the CLI text:\n\n```ts\nconst tools: Record<string, string> = { snapshot: 'page_snapshot', click: 'page_click' }\nconst agent = await createAgentSession(browser, {\n    hint: (command) => (tools[command] ? `${tools[command]}()` : undefined)\n})\n```\n\nFailures throw `SessionError`, with a `code` of type `ErrorCode`. Both are\nexported from `@wdio/session/agent`.\n\n`tsx` and `expect-webdriverio` are optional peer dependencies. `expect` inside\n`exec` needs `expect-webdriverio` installed in your project. TypeScript configs\nload without `tsx` through Node type stripping or jiti.\n","publish_time":1791478998779,"_cnpm_publish_time":1791478998779,"dist-tags":{"latest":"10.2.0","next":"10.2.0-alpha.100.sha-b38abd894"}}