@robinpath/browser 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +103 -0
  2. package/package.json +28 -8
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # @robinpath/browser
2
+
3
+ > Headless browser automation with Puppeteer: launch browsers, navigate pages, interact with elements, take screenshots, generate PDFs, and scrape data
4
+
5
+ ![Category](https://img.shields.io/badge/category-Web-blue) ![Functions](https://img.shields.io/badge/functions-20-green) ![Auth](https://img.shields.io/badge/auth-none-lightgrey) ![License](https://img.shields.io/badge/license-MIT-brightgreen)
6
+
7
+ ## Why use this module?
8
+
9
+ The `browser` module lets you:
10
+
11
+ - Launch a headless browser instance
12
+ - Open a new page in a browser instance
13
+ - Navigate a page to a URL
14
+ - Click an element on the page
15
+ - Type text into an input element
16
+
17
+ All functions are callable directly from RobinPath scripts with a simple, consistent API.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @robinpath/browser
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ No credentials needed — start using it right away:
28
+
29
+ ```robinpath
30
+ browser.newPage "main" "page1"
31
+ ```
32
+
33
+ ## Available Functions
34
+
35
+ | Function | Description |
36
+ |----------|-------------|
37
+ | `browser.launch` | Launch a headless browser instance |
38
+ | `browser.newPage` | Open a new page in a browser instance |
39
+ | `browser.goto` | Navigate a page to a URL |
40
+ | `browser.click` | Click an element on the page |
41
+ | `browser.type` | Type text into an input element |
42
+ | `browser.select` | Select a dropdown option by value |
43
+ | `browser.screenshot` | Take a screenshot of the page |
44
+ | `browser.pdf` | Generate a PDF from the page |
45
+ | `browser.evaluate` | Execute JavaScript in the page context |
46
+ | `browser.content` | Get the full HTML content of the page |
47
+ | `browser.title` | Get the page title |
48
+ | `browser.url` | Get the current URL of the page |
49
+ | `browser.waitFor` | Wait for a selector to appear on the page |
50
+ | `browser.querySelector` | Get text content or attribute of an element |
51
+ | `browser.querySelectorAll` | Get text content of all matching elements |
52
+ | `browser.cookies` | Get all cookies for the current page |
53
+ | `browser.setCookie` | Set a cookie on the page |
54
+ | `browser.close` | Close a page |
55
+ | `browser.closeBrowser` | Close a browser instance and all its pages |
56
+ | `browser.scrape` | High-level scrape: navigate to URL and extract data by CSS selectors |
57
+
58
+ ## Examples
59
+
60
+ ### Open a new page in a browser instance
61
+
62
+ ```robinpath
63
+ browser.newPage "main" "page1"
64
+ ```
65
+
66
+ ### Navigate a page to a URL
67
+
68
+ ```robinpath
69
+ browser.goto "page1" "https://example.com" {"waitUntil": "networkidle2"}
70
+ ```
71
+
72
+ ### Click an element on the page
73
+
74
+ ```robinpath
75
+ browser.click "page1" "#submit-btn"
76
+ ```
77
+
78
+ ## Integration with RobinPath
79
+
80
+ ```typescript
81
+ import { RobinPath } from "@wiredwp/robinpath";
82
+ import Module from "@robinpath/browser";
83
+
84
+ const rp = new RobinPath();
85
+ rp.registerModule(Module.name, Module.functions);
86
+ rp.registerModuleMeta(Module.name, Module.functionMetadata);
87
+
88
+ const result = await rp.executeScript(`
89
+ browser.newPage "main" "page1"
90
+ `);
91
+ ```
92
+
93
+ ## Full API Reference
94
+
95
+ See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
96
+
97
+ ## Related Modules
98
+
99
+ - [`@robinpath/json`](../json) — JSON module for complementary functionality
100
+
101
+ ## License
102
+
103
+ MIT
package/package.json CHANGED
@@ -1,14 +1,34 @@
1
1
  {
2
2
  "name": "@robinpath/browser",
3
- "version": "0.1.0",
4
- "publishConfig": { "access": "public" },
3
+ "version": "0.1.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
5
7
  "type": "module",
6
8
  "main": "dist/index.js",
7
9
  "types": "dist/index.d.ts",
8
- "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } },
9
- "files": ["dist"],
10
- "scripts": { "build": "tsc", "test": "node --import tsx --test tests/*.test.ts" },
11
- "peerDependencies": { "@wiredwp/robinpath": ">=0.20.0" },
12
- "dependencies": { "puppeteer": "^23.0.0" },
13
- "devDependencies": { "@wiredwp/robinpath": "^0.30.1", "tsx": "^4.19.0", "typescript": "^5.6.0" }
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "test": "node --import tsx --test tests/*.test.ts"
22
+ },
23
+ "peerDependencies": {
24
+ "@wiredwp/robinpath": ">=0.20.0"
25
+ },
26
+ "dependencies": {
27
+ "puppeteer": "^23.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@wiredwp/robinpath": "^0.30.1",
31
+ "tsx": "^4.19.0",
32
+ "typescript": "^5.6.0"
33
+ }
14
34
  }