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

Web Interaction with Protocol #132

Open
phodal opened this issue Nov 5, 2024 · 1 comment
Open

Web Interaction with Protocol #132

phodal opened this issue Nov 5, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@phodal
Copy link
Owner

phodal commented Nov 5, 2024

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 like open(url), click(selector), input(selector, text), and submit() 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:

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") }
}

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/

@phodal phodal added the enhancement New feature or request label Nov 5, 2024
@phodal phodal self-assigned this Nov 5, 2024
@phodal
Copy link
Owner Author

phodal commented Nov 5, 2024

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") }
}

@phodal phodal added wontfix This will not be worked on and removed wontfix This will not be worked on labels Nov 24, 2024
@phodal phodal changed the title Web Interaction Web Interaction with Protocol Nov 24, 2024
@phodal phodal closed this as completed Dec 17, 2024
@phodal phodal reopened this Dec 17, 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