@@ -62,34 +62,34 @@ async def get_page_title(ctx: kernel.KernelContext, input_data: PageTitleInput)
6262
6363 return {"title" : title }
6464 finally :
65- await browser . close ( )
65+ client . browsers . delete_by_id ( kernel_browser . session_id )
6666
6767
6868"""
69- Example app that instantiates a persisted Kernel browser that can be reused across invocations
69+ Example app that creates a long-running Kernel browser for manual testing
7070Invoke this action to test Kernel browsers manually with our browser live view
71- https://onkernel.com/docs/browsers/persistence
71+ https://onkernel.com/docs/browsers/live-view
7272Args:
7373 ctx: Kernel context containing invocation information
7474Returns:
7575 A dictionary containing the browser live view url
7676Invoke this via CLI:
7777 kernel login # or: export KERNEL_API_KEY=<your_api_key>
7878 kernel deploy main.py # If you haven't already deployed this app
79- kernel invoke python-basic create-persisted- browser
79+ kernel invoke python-basic create-browser-for-testing
8080 kernel logs python-basic -f # Open in separate tab
8181"""
82- class CreatePersistedBrowserOutput (TypedDict ):
82+ class CreateBrowserForTestingOutput (TypedDict ):
8383 browser_live_view_url : str
8484
85- @app .action ("create-persisted- browser" )
86- async def create_persisted_browser (ctx : kernel .KernelContext ) -> CreatePersistedBrowserOutput :
85+ @app .action ("create-browser-for-testing " )
86+ async def create_browser_for_testing (ctx : kernel .KernelContext ) -> CreateBrowserForTestingOutput :
8787 kernel_browser = client .browsers .create (
8888 invocation_id = ctx .invocation_id ,
89- persistence = { "id" : "persisted-browser" } ,
90- stealth = True , # Turns on residential proxy & auto-CAPTCHA solver
89+ stealth = True ,
90+ timeout_seconds = 3600 , # Keep browser alive for 1 hour
9191 )
9292
9393 return {
9494 "browser_live_view_url" : kernel_browser .browser_live_view_url ,
95- }
95+ }
0 commit comments