Familiarize yourself with the Bytebot Actions
Knowing the type and format of the actions that Bytebot can produce will help you write better prompts.
You can find the list of available actions in the Action Types section.
Actions break down into categories, void actions that don’t produce a result (Click, AssignAttribute), and extract actions that produce a result (CopyText, CopyAttribute, ExtractTable).
The act method will produce one or more void actions. The extract method will produce exactly one extract action.
Most actions are very simple so they don’t require too much attention: for example the Click action only needs a valid xpath as parameter; but other actions, in particular ExtractTable, are more complex.
For example, take this typical ExtractTable action, which extracts a table from a webpage and returns the data in a structured format:
Write clear and concise Prompts
Formulate your prompts clearly and concisely to ensure Bytebot accurately understands and executes the intended actions.
Example:
Utilize parameters for sensitive data
Use the parameters option to securely pass sensitive or dynamic information to the prompt, avoiding hard-coded values. This also ensures that sensitive data is not exposed in the prompt text.
Example:
Don’t perform consecutive actions
Bytebot can handle multiple, independent actions in a single prompt, as long as all actions can be executed on the same DOM.
For Example:
If you need to perform actions that depend on each other, they must be split into separate prompts.
For example, if you need to access the ‘logout’ section which only appears after you click the ‘profile’ button, you should split the actions into two prompts:
- Prompt Bytebot to click the ‘Profile’ button, and execute the action.
- Prompt Bytebot to click the ‘Logout’ button (which will now exist in the DOM).
Implement error handling
Implement robust error handling to gracefully manage failures or unexpected results from prompts.
Example:
Implement testing and validation
Thoroughly test prompts in development environments to fine-tune their accuracy and ensure they perform as expected under various conditions.
Example:
Prompt Iteration and Improvement
Continuously iterate on and improve your prompts based on testing feedback and real-world usage to enhance accuracy and reliability.
Example:
By adhering to these best practices, developers can effectively leverage the prompt method in the Bytebot SDK to automate web tasks efficiently and securely, ensuring high accuracy and reliability in their applications.