{"name":"@wdio/session","version":"9.32.0","keywords":["webdriverio","wdio","session","cli","agent","automation"],"author":"Christian Bromann <mail@bromann.dev>","license":"MIT","_id":"@wdio/session@9.32.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/wdio-session","bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"bin":{"wdio-session":"./bin/wdio-session.js"},"dist":{"shasum":"4e064e6b1b43b1c2794225413ab26ae870396f21","tarball":"http://registry-npm.ywwl.com/@wdio/session/download/@wdio/session-9.32.0.tgz","fileCount":141,"integrity":"sha512-LGBuhVJWNW+mK3HgbxLCrThJF3cqJKwQhJv61l9mTozH2170g6SP5SptG9KXtzs5258Jl1cl2j9v/J+pRt8tKQ==","signatures":[{"sig":"MEUCIEf4/JTEzc8tHhhuWMLnV3ZxPHYN2np6dQ55K8mV6u1xAiEAyF6dq2FDh4KFNRIpv8hbPsDEHxRiLM1Kn0Fx/3ZnbEA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3738639,"size":986743,"noattachment":false,"key":"/@wdio/session/-/@wdio/session-9.32.0.tgz"},"type":"module","types":"./build/index.d.ts","engines":{"node":">=22.19.0"},"exports":{".":{"types":"./build/index.d.ts","import":"./build/index.js"},"./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"},"_npmUser":{"name":"wdio-user","email":"bot@webdriver.io"},"repository":{"url":"git+https://github.com/webdriverio/webdriverio.git","type":"git","directory":"packages/wdio-session"},"description":"Drive browsers, mobile apps and desktop apps with WebdriverIO from the shell","directories":{},"_nodeVersion":"24.12.0","dependencies":{"tsx":"^4.23.15","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":"9.32.0","@wdio/utils":"9.32.0","webdriverio":"9.32.0","@wdio/config":"9.32.0","@wdio/logger":"9.29.1","expect-webdriverio":"^8.0.0-alpha.2","@wdio/display-server":"9.32.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/yargs":"^17.0.33","@types/semver":"^7.5.8","@types/picomatch":"^4.0.2"},"peerDependencies":{"appium":"^3.0.0","@wdio/visual-service":"*","@wdio/electron-service":"*"},"typeScriptVersion":"6.0.3","peerDependenciesMeta":{"appium":{"optional":true},"@wdio/visual-service":{"optional":true},"@wdio/electron-service":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/session_9.32.0_1791005244588_0.2928924874848968","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":1791005244755,"_cnpm_publish_time":1791005244755,"dist-tags":{"latest":"10.2.0","next":"10.2.0-alpha.100.sha-b38abd894"}}