Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when parameter #275

Open
sameelarif opened this issue Dec 4, 2024 · 0 comments
Open

when parameter #275

sameelarif opened this issue Dec 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@sameelarif
Copy link
Collaborator

sameelarif commented Dec 4, 2024

Feature request

Add a method for making the browser wait for a given event to occur, given a natural-language input.

Ideas for Syntax

As a parameter in existing functions:

page.act({
     action: "click the 'add to cart' button",
     when: "the release timer runs out"
})

as a paremeter in a new goto function:

page.goto("https://vercel.com/bfcm", {
     waitFor: "total requests to exceed 86 million"
})

as it's own method:

page.waitFor("the release timer to run out")

baked into existing syntax

page.act({ action: "wait for the release timer to run out" })
page.act({ action: "click the 'add to card button'" })

Ideas for Implementation

Natural Language -> Playwright Code

Pass the current page into an LLM (potentially some JavaScript too since this will deal with reactive pages) and request it to return playwright code that waits for the input condition to pass. This is most efficient if the user's request can be fulfilled with a simple page.waitForLoadState("networkidle") or page.waitForSelector("<xpath>"). If the input requires multiple conditions to pass, we'll ask the LLM to return multiple of these statements.

Potentially the LLM could return custom JavaScript that works for more complex tasks. Like, for example, checking if an element has a certain CSS class or property attached to it.

@sameelarif sameelarif added the enhancement New feature or request label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant