Navigation Basics
Dendrite provides powerful tools for building complex navigation flows for your AI agent web tools. The primary method for navigation isgoto, which loads a page in the current or a new tab. Dendrite also has build in support for authenticating on websites. Additionally, Dendrite offers mechanisms to verify that the correct page has loaded and to wait for specific conditions before proceeding.
The key concepts and methods related to navigation are:
gotofor loading web pagesexpected_pagefor page verificationwait_forfor synchronizing with page conditionsaskfor querying the state of the page- Handling authentication
- Multiple tabs
Navigating to a Page with goto
Thegoto method is used to navigate to a specified URL. It can open the URL in the active page or in a new tab.
The goto method returns a Page object, representing the page.
Basic Usage
Using expected_page for Verification
Theexpected_page parameter allows you to describe the type of page that should be expected after navigation. Dendrite uses this description to verify that the correct page has loaded.
wait_for and ask.
Opening a URL in a New Tab
You can open the URL in a new tab by settingnew_page=True. This creates a new Page instance, allowing for interaction with multiple pages simultaneously.
Authentication Session Management
Authenticating on behalf of a user is simple using Dendrite. Just use our browser extension, Dendrite Vault, to handle sessions and then provide the url(s) you want to authenticate on when initiating your Dendrite browser.Authentication
Read more about authentication here
Managing Multiple Tabs and Pages
When working with multiple tabs, it’s important to keep track of eachPage instance to ensure that actions are performed on the correct page. The Dendrite instance maintains a list of all open pages through the pages property.
pages property returns a list of all active Page instances managed by the Dendrite browser.
Performing Actions on Specific Pages
To perform actions on a specific page, use methods on thePage class rather than the Dendrite class. This ensures that the interaction occurs on the intended page.
Example: Interacting with Multiple Pages
Page instances.