Search packages, repositories and app categories

Package detailsv3.2.0

webdriver

Provides WebDriver bindings for Dart. Supports WebDriver JSON interface and W3C spec. Requires the use of WebDriver remote server.

30-day downloads
11.4M
Likes
67
Pub points
130

Install package

flutter pub add webdriver

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The webdriver package provides WebDriver bindings for Dart, enabling automated browser testing through the WebDriver JSON interface and W3C standards. It requires a separate WebDriver remote server to function, allowing Dart applications to control browsers programmatically. This package is ideal for writing end-to-end tests that simulate real user interactions across different browsers and platforms. It supports modern web testing workflows and integrates well with testing frameworks like test or integration_test.

Use cases

  • Automated browser testing
  • End-to-end testing of web applications
  • Cross-browser compatibility testing
  • Integration testing with real browsers
  • Test automation in CI/CD pipelines

Key features

  • Supports WebDriver JSON and W3C specifications
  • Requires external WebDriver server
  • Enables browser automation via Dart
  • Facilitates real user interaction simulation
  • Integrates with Dart testing frameworks

Suitable for

  • Dart developers doing web testing
  • Teams using CI/CD pipelines
  • Test engineers automating browser workflows
  • Projects requiring cross-browser validation
  • Developers following W3C WebDriver standards

Considerations

  • Requires a running WebDriver server (e.g., Selenium Server)
  • Not suitable for headless-only scenarios without setup
  • Limited to browser automation, not mobile or native UI testing
  • Dependent on external server stability
  • May require additional configuration for secure environments

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

CI pub package package publisher

Provides WebDriver bindings for Dart. These use the WebDriver JSON interface, and as such, require the use of the WebDriver remote server.

Using package:webdriver

In your Dart code, you can use:

import 'package:webdriver/io.dart';

WebDriver driver = createDriver(...);

This will use by default the asynchronous, JSON wire spec implementation. You now can also use a synchronous version of WebDriver:

import 'package:webdriver/sync_io.dart';

final driver = createDriver(...);

This version of WebDriver supports both the JSON wire spec and W3C spec, allowing use with modern versions of Firefox. This defaults to the JSON wire spec, but can also be configured to use the W3C spec or even to try and automatically infer the spec during session creation:

final w3cDriver = createDriver(spec: WebDriverSpec.W3c);  // Use W3C spec.

final anyDriver = createDriver(spec: WebDriverSpec.Auto); // Infer spec.

Testing

Unfortunately using bazel with Dart libraries and Dart WebDriver is not yet supported. We hope to add this at some point, but for now pub still works.

As a consequence, running tests is a bit more complicated than we'd like:

  1. Launch a WebDriver binar(ies).

    First, bring up chromedriver / geckodriver. Other conforming WebDriver binaries should work as well, but we test against these:

    chromedriver --port=4444 --url-base=wd/hub --verbose
    geckodriver --port=4445
    

    ChromeDriver is used to test our JSON wire spec implementation, and geckodriver is used to test our W3C spec implementation.

    Synchronous tests are labeled as Chrome/Firefox. All async tests run exclusively against Chrome (as async, like ChromeDriver supports only the old JSON wire spec).

  2. Run a test. All files suffixed with _test.dart are tests.

    dart test test/path/to/the_test.dart -r expanded -p vm
    

    Or to run all tests:

    dart test -r expanded -p vm
    

    You should probably go get a coffee or something, this is gonna take a while.

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package