Skip to content

Commit 8363aaa

Browse files
committed
Updated code examples
Updated code examples comparing Scrapybara and Kernel
1 parent 0057bd1 commit 8363aaa

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

migrations/scrapybara.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ await client.browsers.delete_by_id(kernel_browser.session_id)
6262
```python
6363
# First session - save auth
6464
instance = client.start_browser()
65-
instance.browser.start()
6665
# ... login to website via Playwright ...
6766
auth_state = instance.browser.save_auth(name="my-login")
6867
instance.stop()
6968

7069
# Second session - load auth
7170
instance2 = client.start_browser()
72-
instance2.browser.start()
73-
instance2.browser.authenticate(auth_state.auth_state_id)
71+
instance2.browser.authenticate(auth_state_id=auth_state.auth_state_id)
7472
# ... browser now has saved cookies ...
7573
```
7674

@@ -98,7 +96,7 @@ browser2 = await client.browsers.create(
9896
instance = client.start_browser()
9997
# ... trigger download in browser ...
10098
# Then use file operations
101-
downloaded_file = instance.file(action="read", path="/download/path")
99+
downloaded_file = instance.file(command="read", path="/download/path")
102100
```
103101

104102
**Kernel**
@@ -129,17 +127,15 @@ instance.resume() # Resume work
129127
```python
130128
# Automatic standby mode + persistence
131129
browser = await client.browsers.create(
132-
persistence={"id": "my-long-session"},
133-
timeout_seconds=86400 # 24 hours
130+
persistence={"id": "my-long-session"}
134131
)
135132
# ... do some work ...
136-
await client.browsers.delete_by_id(browser.session_id)
133+
# Browser enters standby mode between connections
137134

138-
# Later - automatically restored with full state
135+
# Later - reuse the exact browser instance with full state
139136
browser2 = await client.browsers.create(
140137
persistence={"id": "my-long-session"}
141138
)
142-
# Browser state fully restored (DOM, cookies, zoom, etc.)
143139
```
144140

145141

0 commit comments

Comments
 (0)