webdriver 2.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 83

webdriver

Build Status pub package

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

Installing

  1. Depend on it

    Add this to your package's pubspec.yaml file:

    dependencies:
      webdriver: any
    

    If your package is an application package you should use any as the version constraint.

  2. Install it

    If you're using IntelliJ, choose:

    Control + Shift + A > Pub: Get Dependencies
    

    If you're using the Dart Editor, choose:

    Menu > Tools > Pub Install
    

    Or if you want to install from the command line, run:

    $ pub install
    
  3. Import it

    Now 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.

    pub run test/path/to/test.dart -r expanded -p vm
    

    Or to run all tests:

    pub run test -r expanded -p vm
    

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

v2.0.0

  • Dropped support for pkg:unittest.
  • Add W3C spec mouse and keyboard support.
  • Remove deprecated methods in async WebDriver.

The two big changes are the addition of support for synchronous communication via the package:sync_http (along with an accompanying synchronous API) and support for the W3C spec.

Currently, only the synchronous API supports the W3C spec, but in the future both asynchronous and synchronous APIs will support this.

v1.2.4

  • Adds Adds null check for status before checking status code. Avoids throwing exceptions if status code is not present. (Due to oversight this was never properly released.)

v1.2.3

  • Enable generics for waitFor.

v1.2.2+1

  • Disable generics for waitFor.

v1.2.2

  • Refactor tests.
  • Make project buildable and testable with Bazel.

v1.2.1

  • Enable redirects to handle 303 responses from Selenium.

v1.2.0

  • Fix all strong mode errors.

v1.1.1

  • Fix some analyzer warnings.
  • _performRequest now uses whenComplete, not finally (#119).

v1.1.0

  • Added WebDriver.captureScreenshotAsBase64(), which returns the screenshot as a base64-encoded string.
  • Added WebDriver.captureScreenshotAsList(), which returns the screenshot as list of uint8.
  • Deprecated WebDriver.captureScreenshot() due to bad performance (#114). Please use the new screenshot methods instead.
  • Removed dependency on crypto package.

Thanks to @blackhc and @xavierhainaux for the contributions.

v1.0.0

No functional change, just bumping the version number.

v0.10.0-pre.15

  • Add Future-based listeners to web_driver.dart.
  • Use google.com/ncr to avoid redirect when running outside US
  • Add chords support to keyboard.dart.
  • Add enum for mouse buttons (breaking API change!)

v0.10.0-pre.14

  • Adds support for enabling/disabling listeners to WebDriver.
  • Adds awaitChecking mode to Lock class.

v0.10.0-pre.13

  • Lots of cleanup and new features.

v0.10.0-pre.12

  • Adds a Stepper interface and StdioStepper which allows control of execution of WebDriver commands.

v0.10.0-pre.11

  • Improve exception stack traces.
  • Add option to quit() to not end the WebDriver session.

v0.10.0-pre.10

  • Minor updates.

v0.10.0-pre.9

  • Adds command listening.

v0.10.0-pre.8

  • Add support/forwarder.dart.
  • Move async_helpers.dart to support/async.dart.

v0.10.0-pre.7

  • Fix expect implementation.

v0.10.0-pre.6

  • Fixes to pubspec.
  • Added missing copyright notices.

v0.10.0-pre.4

  • Various cleanup.
  • Change captureScreenshot to return Stream.

v0.10.0-pre.3

  • Rename some methods.
  • Add WebDriver.get() and remove WebDriver.navigate.to().

v0.10.0-pre.2

  • Added close() method to CommandProcessor that gets called by WebDriver.quit().
  • Ensure that HttpClient in _IOCommandProcessor gets closed.
  • Add fromExistingSession() functions to allow creation of WebDriver instances connected to existing sessions.

v0.10.0-pre.1

  • Isolate HTTP code from the rest of the WebDriver implementation.
  • Create support for running WebDriver from inside browser.
  • Other cleanup.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  webdriver: ^2.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:webdriver/async_core.dart';
import 'package:webdriver/async_io.dart';
import 'package:webdriver/core.dart';
import 'package:webdriver/html.dart';
import 'package:webdriver/io.dart';
import 'package:webdriver/support/async.dart';
import 'package:webdriver/support/firefox_profile.dart';
import 'package:webdriver/support/forwarder.dart';
import 'package:webdriver/support/stdio_stepper.dart';
import 'package:webdriver/sync_core.dart';
import 'package:webdriver/sync_io.dart';
  
Version Uploaded Documentation Archive
2.0.0 Aug 7, 2018 Go to the documentation of webdriver 2.0.0 Download webdriver 2.0.0 archive
1.2.3 Feb 2, 2017 Go to the documentation of webdriver 1.2.3 Download webdriver 1.2.3 archive
1.2.2+1 Jan 12, 2017 Go to the documentation of webdriver 1.2.2+1 Download webdriver 1.2.2+1 archive
1.2.2 Jan 11, 2017 Go to the documentation of webdriver 1.2.2 Download webdriver 1.2.2 archive
1.2.1 Sep 9, 2016 Go to the documentation of webdriver 1.2.1 Download webdriver 1.2.1 archive
1.2.0 Aug 15, 2016 Go to the documentation of webdriver 1.2.0 Download webdriver 1.2.0 archive
1.1.1 Jun 8, 2016 Go to the documentation of webdriver 1.1.1 Download webdriver 1.1.1 archive
1.1.0 May 3, 2016 Go to the documentation of webdriver 1.1.0 Download webdriver 1.1.0 archive
1.0.0 Feb 10, 2016 Go to the documentation of webdriver 1.0.0 Download webdriver 1.0.0 archive
0.9.1 Feb 20, 2015 Go to the documentation of webdriver 0.9.1 Download webdriver 0.9.1 archive

All 73 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
67
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Suggestions

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use webdriver.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.61.0 <3.0.0
archive >=1.0.0 <3.0.0 2.0.2
matcher ^0.12.3 0.12.4
path ^1.3.0 1.6.2
stack_trace ^1.3.0 1.9.3
sync_http ^0.1.1 0.1.3
Transitive dependencies
args 1.5.0
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
typed_data 1.1.6
Dev dependencies
test ^1.0.0