You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Options:
26
26
27
27
Commands:
28
28
run [options] <file> Execute a file in a browser.
29
-
generate Generate files from templates.
29
+
generate Generate files from templates or remote data.
30
30
help [command] display helpforcommand
31
31
```
32
32
@@ -75,6 +75,20 @@ export default defineConfig({
75
75
});
76
76
```
77
77
78
+
#### Save browser session
79
+
80
+
Using Playwright, you can launch a new session with the `generate login` command. This will launch a new browser session where you can authenticate to a website. After you have authenticated you can close the browser session. You session will be saved to a local file `.scratchpad/login.json`.
81
+
82
+
```bash
83
+
npx @heymp/scratchpad@next login
84
+
```
85
+
86
+
You can then reuse the session by using the `login` option when using the `run` command.
87
+
88
+
```bash
89
+
npx @heymp/scratchpad@next run --login
90
+
```
91
+
78
92
#### Reroute Documents
79
93
80
94
The `rerouteDocument` function allows you to replace the HTML content of any webpage with a local HTML file from your system. This is incredibly useful for testing changes or developing components in the context of a live site without deploying your code.
| document | Fetch HTML source of url and save it to a local file. This is helpful when using the `rerouteDocument` command. |`npx @heymp/scratchpad@next generate document https://www.example.com pages `|
185
+
| login | Launch a new browser that saves your session so it can be reused. |`npx @heymp/scratchpad@next generate login`|
186
+
187
+
## Default exposed functions
167
188
168
-
To send log information from the Chromium browser to node.js we expose the following functions.
189
+
The following functions are exposed by default that can be used in the `run` commands target file.
0 commit comments