Prerequisites
Install Selenium 4+ alongside the Notte SDK:Selenium 4 or higher is required for CDP support. Earlier versions do not support connecting to remote browsers via CDP.
Connect Selenium to Notte Session
Start a Notte session and connect Selenium to it using the CDP URL:Alternative: Using Notte’s Built-in Page
A more reliable way is to use Notte’s built-in Playwright page directly:selenium_playwright_alternative.py
Basic Web Automation
If you’re using Selenium with Notte, here’s a basic example using Playwright (recommended):selenium_basic_automation.py
Finding Elements
Use Playwright-style element selection with Notte’s page:selenium_finding_elements.py
Waiting for Elements
Wait for elements to appear or conditions to be met:selenium_waiting_elements.py
Taking Screenshots
Capture screenshots during automation:selenium_screenshots.py
Executing JavaScript
Run custom JavaScript in the page context:selenium_javascript.py
Handling Alerts and Dialogs
Manage browser dialogs using Playwright:selenium_dialogs.py
Working with Frames
Access iframe content:selenium_frames.py
Why Use Playwright Instead of Selenium?
For Notte sessions, Playwright is recommended over Selenium because:- Native Integration: Notte sessions include a built-in Playwright page (
session.page) - Better API: Playwright has a modern, async-friendly API with better selectors
- Auto-waiting: Playwright automatically waits for elements to be ready
- Network Control: Built-in network interception and mocking
- Multiple Contexts: Easier to manage multiple browser contexts
- Better Performance: Playwright is generally faster and more reliable
Selenium is best when:
- You have existing Selenium test suites you want to migrate
- Your team is already trained in Selenium
- You’re using Selenium Grid infrastructure
Playwright is best when:
- You’re starting a new automation project
- You want modern browser automation features
- You value simplicity and better debugging
Migration from Selenium
If you’re migrating from Selenium, here’s a quick comparison:Complete Example: Form Automation
Here’s a complete example using Playwright with Notte (recommended approach):Best Practices
1. Use Playwright Instead
For new projects with Notte, use Playwright instead of Selenium:selenium_builtin_page.py
2. Explicit Waits
Always wait for elements before interacting:selenium_explicit_waits.py
3. Unique Selectors
Use unique, stable selectors:selenium_unique_selectors.py
4. Error Handling
Wrap operations in try-except blocks:selenium_error_handling.py
Next Steps
Connect with Playwright
Use Playwright with Notte (Recommended)
Connect with Puppeteer
Use Puppeteer with Notte sessions
Session Configuration
Configure session settings
External Browser Providers
Connect Notte to Kernel.sh and other providers

