{"id":"4c0ac24f-b39d-4221-8a10-c9883793617c","task_name":"Convert to Stagehand Script","summary":"Convert an existing Playwright script to Stagehand format using Browserbase's integrated playground, then execute the converted script. This workflow enables you to modernize browser automation code from Playwright to Stagehand's agent-based approach.","description":"Converts a Playwright script to a Stagehand script in the Browserbase playground and executes it.","tools_used":[],"agent_steps":[{"step_number":1,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/overview","element":{"name":"Playground","role":"link","selector":"","xpath":"//*[@id=\"base-ui-_r_uf_\"]","attributes":{"id":"base-ui-_r_uf_","href":"/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","data-size":"default","data-slot":"sidebar-menu-button","data-active":"false","data-sidebar":"menu-button"}},"value":"","keys":[],"file_paths":[],"description":"Navigate to the Browserbase Playground by clicking the 'Playground' link in the main navigation. This is where you can write, test, and convert browser automation scripts in a cloud-hosted environment."},{"step_number":2,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"console.info(\"Launching browser...\"); /* To make things easier, we've setup Playwright using the window variables. You can access it and your API key using window.playwright or window.connectionString. */ console.info('Connected!'); /** * 👋 Welcome ","role":"presentation","selector":"","xpath":"//html/body/div[5]/main/div[2]/div/div/div/div[1]/div[3]/section/div/div/div[1]/div[2]/div[1]/div[4]","attributes":{}},"value":"","keys":[],"file_paths":[],"description":"Click inside the code editor area to focus it. The editor contains a welcome template and placeholder code. You will replace this with your Playwright script."},{"step_number":3,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"console.info(\"Launching browser...\"); /* To make things easier, we've setup Playwright using the window variables. You can access it and your API key using window.playwright or window.connectionString. */ console.info('Connected!'); /** * 👋 Welcome ","role":"presentation","selector":"","xpath":"//html/body/div[5]/main/div[2]/div/div/div/div[1]/div[3]/section/div/div/div[1]/div[2]/div[1]/div[4]","attributes":{}},"value":"","keys":[],"file_paths":[],"description":"Click again to ensure the editor is fully focused and ready to receive input. This ensures that your subsequent paste operation will insert the script into the correct location."},{"step_number":4,"action_type":"key","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"","role":"","selector":"","xpath":"","attributes":{}},"value":"","keys":["Cmd","v"],"file_paths":[],"description":"Paste your Playwright script from the clipboard by pressing Cmd+V (or Ctrl+V on Windows/Linux). This inserts the script into the editor, replacing any template code."},{"step_number":5,"action_type":"type","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"Editor content;Press Alt+F1 for Accessibility Options.","role":"textbox","selector":"","xpath":"//html/body/div[5]/main/div[2]/div/div/div/div[1]/div[3]/section/div/div/div[1]/textarea","attributes":{"aria-label":"Editor content;Press Alt+F1 for Accessibility Options."}},"value":"","keys":[],"file_paths":[],"description":"If needed, manually add or adjust any script content in the editor textbox. This step allows you to make quick edits to the Playwright code before conversion, such as fixing syntax errors or removing incompatible features."},{"step_number":6,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"Convert to Stagehand","role":"button","selector":"","xpath":"//*[@id=\"base-ui-_r_169_\"]","attributes":{"id":"base-ui-_r_169_","type":"button"}},"value":"","keys":[],"file_paths":[],"description":"Click the 'Convert to Stagehand' button to automatically transform your Playwright script into a Stagehand-compatible script. Browserbase will analyze your code and rewrite it using Stagehand's agent-based APIs."},{"step_number":7,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"Accept changes","role":"button","selector":"","xpath":"//html/body/div[5]/main/div[2]/div/div/div/footer/button[1]","attributes":{"type":"button"}},"value":"","keys":[],"file_paths":[],"description":"Review the converted script and click 'Accept changes' to confirm the conversion. This step commits the Stagehand script as your active code in the playground."},{"step_number":8,"action_type":"click","url":"https://www.browserbase.com/orgs/npvugcykwvpp/4f9b47c8-67f4-4a9b-b41b-0fe9a66464d5/playground","element":{"name":"Run ⌘","role":"button","selector":"","xpath":"//html/body/div[5]/main/div[2]/div/div/header/div/div[2]/button[3]","attributes":{"type":"button","data-testid":"playground-run-button"}},"value":"","keys":[],"file_paths":[],"description":"Click the 'Run' button (keyboard shortcut: Cmd+Enter) to execute the converted Stagehand script in a live browser session on Browserbase. The script will run in a real browser environment and output results to the console."}]}