Open phodal opened 2 weeks ago
Change syntax for new type block-action
openWebpage("https://example.com/login") {
waitFor("#username", timeout = 5000) |
input("#username", "user123") |
input("#password", "password123") |
click("#submit") |
waitFor("#dashboard", timeout = 10000) |
onError { print("Failed to log in") }
}
Is your feature request related to a problem? Please describe.
In web automation, it can be cumbersome and error-prone to write individual code blocks for each webpage interaction step (e.g., opening a URL, clicking, inputting text, etc.). This often results in repetitive and complex code, especially when handling scenarios that involve waiting for elements or dealing with conditional logic. I’m always frustrated by how much manual setup is required for even simple interaction pipelines.
Describe the solution you'd like
I would like a streamlined,
pipeline
-style approach for handling webpage interactions in a single, chainable format. This would allow commands likeopen(url)
,click(selector)
,input(selector, text)
, andsubmit()
to be written as a fluid sequence, improving readability and simplifying automation setup. Additionally, built-in support for wait conditions (e.g.,waitFor(selector, timeout)
) and error handling (onError(action)
) would make it easier to manage asynchronous page elements and unexpected issues.Describe alternatives you've considered
An alternative approach could involve writing helper functions for each step and chaining them manually. However, this adds extra complexity and does not provide the same level of readability or modularity. Using existing libraries (e.g., Selenium) is another option, but they lack the simplicity and intuitive flow that a custom pipeline-style API would provide.
Additional context
This feature could significantly reduce code length and complexity, particularly in scenarios with multi-step interactions on dynamic web pages. For example:
This pipeline-style interaction could enhance both productivity and maintainability in web automation projects.
Usecase: use online chat or other tools, like https://v0.dev/