Skip to main content
Notte sessions can be controlled with Selenium 4’s CDP support. This allows you to use Selenium’s WebDriver API while benefiting from Notte’s cloud infrastructure, anti-detection features, and session management.

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:
The CDP connection approach shown above works in most cases, but Selenium’s CDP support may vary by version. For more reliable connections, consider using the Remote WebDriver approach below.

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
For Python-based automation with Notte, we recommend using Playwright instead of Selenium. Notte sessions include a built-in Playwright page (session.page) that’s easier to use and better integrated.

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:
  1. Native Integration: Notte sessions include a built-in Playwright page (session.page)
  2. Better API: Playwright has a modern, async-friendly API with better selectors
  3. Auto-waiting: Playwright automatically waits for elements to be ready
  4. Network Control: Built-in network interception and mocking
  5. Multiple Contexts: Easier to manage multiple browser contexts
  6. 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