Skyvern-AI / skyvern

Automate browser-based workflows with LLMs and Computer Vision
https://www.skyvern.com
GNU Affero General Public License v3.0
5.75k stars 418 forks source link

Give playwright access to CodeBlock #588

Closed ykeremy closed 2 months ago

ykeremy commented 2 months ago
### Example workflow:
title: "Test codeblock with page access"
description: ""
workflow_definition:
  parameters: []
  blocks:
      - block_type: task
        label: simple-task
        url: https://www.ipaddress.my/
        navigation_goal: null
        data_extraction_goal: Extract the IP address and location.
      - block_type: code
        label: get_tab_details
        code: |
          print("Getting tab details")
          result = {
              "url": skyvern_page.url,
              "title": await skyvern_page.title()
          }
          print("Got details:", result)
          print("Get a cat")
          await skyvern_page.goto("https://cataas.com/cat")

Result:

On 25th second, it navigates to the page from the codeblock 2024-07-11T08_53_08.396373_a_279193442447084520_recording.webm

WorkflowRunStatusResponse(..., outputs={
'simple-task_output': {...}, 'send_get_request_output': 
{'result': {'url': 'https://www.ipaddress.my/', 'title': 'My IP Address | IPAddress.my'}}})

--


:rocket: This description was created by Ellipsis for commit e7959e1d2d49b791463a09aacf039599978e8fa2

Summary:

Added Playwright browser access to CodeBlock, introduced get_for_workflow_run method in BrowserManager, and provided an example workflow with its result.

Key points:


Generated with :heart: by ellipsis.dev