Viewing version 3.1.0. Open the latest package page.
webdriver
3.1.0Provides WebDriver bindings for Dart. Supports WebDriver JSON interface and W3C spec. Requires the use of WebDriver remote server.
Readme
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:
-
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=4445ChromeDriver 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).
-
Run a test. All files suffixed with
_test.dartare tests.dart test test/path/to/the_test.dart -r expanded -p vmOr to run all tests:
dart test -r expanded -p vmYou should probably go get a coffee or something, this is gonna take a while.
Changelog
3.1.0
- Add a
reasonargument toClock.waitFor. - Explicitly close http clients on quit.
3.0.4
- Require Dart 3.1.
3.0.3
- Include a content-type header when sending requests from
async_html.dart. The content-type is necessary for compatibility with GeckoDriver 0.27.0 and newer versions. The content-type header was already being sent in IO clients for a long time, so only the HTML client had to be updated.
3.0.2
- Require Dart 2.18.
- "Officially" deprecate
core.dartandio.dartlibraries. - Remove the dependecy on
package:archive.
3.0.1
- Return Future with non-nullable generic from
waitFor. The genericTmay still be a nullable type where required. - Treat 405 response code as an unknown command for compatibility with GeckoDriver.
3.0.0
- Stable release for null safety.
v2.1.2
- Updated to latest version of sync_http.
v2.1.1
- Forward-compatible fix for upcoming Dart SDK breaking change
(
HttpClientResponseimplementingStream<Uint8List>)
v2.1.0
- Full support of JsonWire and W3C protocol specs in sync and async WebDriver.
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 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.
_performRequestnow useswhenComplete, notfinally(#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
awaitCheckingmode 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.darttosupport/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
captureScreenshotto return Stream.
v0.10.0-pre.3
- Rename some methods.
- Add
WebDriver.get()and removeWebDriver.navigate.to().
v0.10.0-pre.2
- Added
close()method to CommandProcessor that gets called byWebDriver.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.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'webdriver:3.1.0'pubspec.yaml
name: webdriver
version: 3.1.0
description: >-
Provides WebDriver bindings for Dart. Supports WebDriver JSON interface and
W3C spec. Requires the use of WebDriver remote server.
repository: https://github.com/google/webdriver.dart
environment:
sdk: ^3.1.0
dependencies:
matcher: ^0.12.10
path: ^1.8.0
stack_trace: ^1.10.0
sync_http: ^0.3.0
dev_dependencies:
archive: ^3.3.0
lints: ^4.0.0
test: ^1.16.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.2.7 | On demand | Download | 533862f1…3827d7 |
| 0.2.8+2 | On demand | Download | d1767ffd…7dafde |
| 0.2.9+7 | On demand | Download | 3dd0f4af…7ad820 |
| 0.3.1+1 | On demand | Download | cdb2de82…b3b788 |
| 0.3.2 | On demand | Download | babf6ed8…db556f |
| 0.3.4 | On demand | Download | dadf2181…edd083 |
| 0.3.5+1 | On demand | Download | d3ac9f97…96e8d4 |
| 0.3.7+6 | On demand | Download | da10e0f8…19c261 |
| 0.4.0 | On demand | Download | 33e32b4a…3ab62a |
| 0.4.1 | On demand | Download | 77c8526f…76b597 |
| 0.4.2 | On demand | Download | 6b2d0801…00d2e6 |
| 0.4.3+1 | On demand | Download | b9948b90…6051f0 |
| 0.4.4+4 | On demand | Download | 6484bb7a…9e2d84 |
| 0.4.5+1 | On demand | Download | 267cf558…71557e |
| 0.4.7+1 | On demand | Download | 60320993…f26ed5 |
| 0.5.0+1 | On demand | Download | 855653b4…db029e |
| 0.5.1 | On demand | Download | 55ac5726…e38b9f |
| 0.5.4 | On demand | Download | 2fff77be…44ab2d |
| 0.5.5 | On demand | Download | 21dd541b…979c59 |
| 0.5.6 | On demand | Download | d06a762e…a4d193 |
| 0.5.7 | On demand | Download | 06685b63…3c58e2 |
| 0.5.9 | On demand | Download | 8e38424f…ed85b3 |
| 0.5.11+1 | On demand | Download | 9638f6aa…f2a72c |
| 0.5.12 | On demand | Download | 2fec7d9e…3e8492 |
| 0.5.13 | On demand | Download | f5739110…5a3a9b |
| 0.5.14+1 | On demand | Download | 3122d43a…774f6a |
| 0.5.14+3 | On demand | Download | fceb4351…de5a15 |
| 0.5.15 | On demand | Download | f89aefe3…f54e45 |
| 0.5.16 | On demand | Download | 1fee8425…063214 |
| 0.5.17 | On demand | Download | 44c5a60e…0265a9 |
| 0.5.20 | On demand | Download | 8ed56d4f…70e43b |
| 0.6.1 | On demand | Download | 632ff7d8…a59874 |
| 0.6.2 | On demand | Download | a2d631cf…1b58be |
| 0.6.3+1 | On demand | Download | 45250954…014912 |
| 0.6.5 | On demand | Download | 768181d1…1d5715 |
| 0.6.6 | On demand | Download | 07196241…ff9b33 |
| 0.6.8 | On demand | Download | 0e029dda…9848c0 |
| 0.6.9 | On demand | Download | ff3d8791…3c1b87 |
| 0.6.9+2 | On demand | Download | 7cea84ee…8d5d12 |
| 0.6.10 | On demand | Download | 2beb0cc3…25001a |
| 0.7.0 | On demand | Download | 91f38787…cd2e96 |
| 0.7.1 | On demand | Download | f63749d0…eec201 |
| 0.7.2 | On demand | Download | db1565a1…a25f51 |
| 0.7.3 | On demand | Download | 92915a64…6ef767 |
| 0.7.4 | On demand | Download | 46c7867f…3a98d1 |
| 0.7.5 | On demand | Download | fcf6f625…557c3e |
| 0.8.7 | On demand | Download | 306f0844…b2b12f |
| 0.8.8 | On demand | Download | d8aafb6a…c85160 |
| 0.9.0 | On demand | Download | 1414d8b2…757a47 |
| 0.9.1 | On demand | Download | b33f461b…3e3e95 |
| 0.10.0-pre.2 | On demand | Download | 4ace7b34…4fb146 |
| 0.10.0-pre.3 | On demand | Download | 9019d98e…7404d5 |
| 0.10.0-pre.5 | On demand | Download | 6bc7c27a…a1dd5b |
| 0.10.0-pre.6 | On demand | Download | de941984…c059d1 |
| 0.10.0-pre.7 | On demand | Download | ed5b7f34…12facc |
| 0.10.0-pre.8 | On demand | Download | c8a610f7…6cd94f |
| 0.10.0-pre.9 | On demand | Download | e6e1a943…beb6b4 |
| 0.10.0-pre.10 | On demand | Download | 225f1864…7e14c1 |
| 0.10.0-pre.11 | On demand | Download | 02f81379…0a9515 |
| 0.10.0-pre.12 | On demand | Download | dd8cd51b…43aba3 |
| 0.10.0-pre.13 | On demand | Download | e297fc4c…57bf25 |
| 0.10.0-pre.15 | On demand | Download | 2f83cf89…155676 |
| 1.0.0 | On demand | Download | 79bc8135…4c4957 |
| 1.1.0 | On demand | Download | 38e810c7…12623b |
| 1.1.1 | On demand | Download | 5b6d47be…01243a |
| 1.2.0 | On demand | Download | 1507bb4f…7e2032 |
| 1.2.1 | On demand | Download | b86c6336…98cb5e |
| 1.2.2 | On demand | Download | 893b424f…e8201f |
| 1.2.2+1 | On demand | Download | cb876f11…c71652 |
| 1.2.3 | On demand | Download | 6c07e7c2…7b3189 |
| 2.0.0-beta | On demand | Download | 08d9a264…e25653 |
| 2.0.0-beta+1 | On demand | Download | 7c92be2a…f42e0f |
| 2.0.0 | On demand | Download | a639bfab…a7330d |
| 2.1.0 | On demand | Download | bb56bd41…54a706 |
| 2.1.1 | On demand | Download | c29ed375…4865c4 |
| 2.1.2 | On demand | Download | af7ac0e9…2d7c92 |
| 3.0.0-nullsafety.0 | On demand | Download | e22e0d31…6a3ee4 |
| 3.0.0-nullsafety.1 | On demand | Download | f775f1dd…f0242e |
| 3.0.0 | On demand | Download | 404f637d…485886 |
| 3.0.1 | On demand | Download | ef67178f…f9d841 |
| 3.0.2 | On demand | Download | 3c923e91…f86c49 |
| 3.0.3 | On demand | Download | 003d7da9…ed845e |
| 3.0.4 | On demand | Download | 3d773670…4d61c8 |
| 3.1.0 | Cached · Upstream SHA-256 matched | Download | 2f3a14ca…a7cade |
| 3.2.0 | Cached · Upstream SHA-256 matched | Download | 28b82ec8…e5657e |
Dependencies
matcher "^0.12.10"
path "^1.8.0"
stack_trace "^1.10.0"
sync_http "^0.3.0"