[webdriver] Remove `new` and redundant `const`. Use `=` in named parameters. Use new typedef syntax.
Fixed with `dartfmt --fix`
PiperOrigin-RevId: 233667755
diff --git a/lib/async_core.dart b/lib/async_core.dart
index 3d0def8..ce49382 100644
--- a/lib/async_core.dart
+++ b/lib/async_core.dart
@@ -70,12 +70,8 @@
throw 'Unexpected spec: ${session.spec}';
}
- return new WebDriver(
- uri,
- session.id,
- new UnmodifiableMapView(session.capabilities),
- createRequestClient(uri.resolve('session/${session.id}/')),
- session.spec);
+ return WebDriver(uri, session.id, UnmodifiableMapView(session.capabilities),
+ createRequestClient(uri.resolve('session/${session.id}/')), session.spec);
}
/// Creates an async WebDriver from existing session.
@@ -102,12 +98,8 @@
throw 'Unexpected spec: ${session.spec}';
}
- return new WebDriver(
- uri,
- session.id,
- new UnmodifiableMapView(session.capabilities),
- createRequestClient(uri.resolve('session/${session.id}/')),
- session.spec);
+ return WebDriver(uri, session.id, UnmodifiableMapView(session.capabilities),
+ createRequestClient(uri.resolve('session/${session.id}/')), session.spec);
}
/// Creates an async WebDriver from existing session with a sync function.
@@ -131,6 +123,6 @@
throw 'Unexpected spec: $spec';
}
- return new WebDriver(uri, sessionId, new UnmodifiableMapView(capabilities),
+ return WebDriver(uri, sessionId, UnmodifiableMapView(capabilities),
createRequestClient(uri.resolve('session/${sessionId}/')), spec);
}
diff --git a/lib/async_html.dart b/lib/async_html.dart
index 77744de..c3740ff 100644
--- a/lib/async_html.dart
+++ b/lib/async_html.dart
@@ -37,7 +37,7 @@
{Uri uri,
Map<String, dynamic> desired,
WebDriverSpec spec = WebDriverSpec.Auto}) =>
- core.createDriver((prefix) => new AsyncXhrRequestClient(prefix),
+ core.createDriver((prefix) => AsyncXhrRequestClient(prefix),
uri: uri, desired: desired, spec: spec);
/// Creates an async WebDriver from existing session using
@@ -50,7 +50,7 @@
Future<core.WebDriver> fromExistingSession(String sessionId,
{Uri uri, WebDriverSpec spec = WebDriverSpec.Auto}) =>
core.fromExistingSession(
- (prefix) => new AsyncXhrRequestClient(prefix), sessionId,
+ (prefix) => AsyncXhrRequestClient(prefix), sessionId,
uri: uri, spec: spec);
/// Creates an async WebDriver from existing session with a sync function using
@@ -67,5 +67,5 @@
core.WebDriver fromExistingSessionSync(String sessionId, WebDriverSpec spec,
{Uri uri, Map<String, dynamic> capabilities}) =>
core.fromExistingSessionSync(
- (prefix) => new AsyncXhrRequestClient(prefix), sessionId, spec,
+ (prefix) => AsyncXhrRequestClient(prefix), sessionId, spec,
uri: uri, capabilities: capabilities);
diff --git a/lib/async_io.dart b/lib/async_io.dart
index 80dea93..b88ad3e 100644
--- a/lib/async_io.dart
+++ b/lib/async_io.dart
@@ -39,7 +39,7 @@
{Uri uri,
Map<String, dynamic> desired,
core.WebDriverSpec spec = core.WebDriverSpec.Auto}) =>
- core.createDriver((prefix) => new AsyncIoRequestClient(prefix),
+ core.createDriver((prefix) => AsyncIoRequestClient(prefix),
uri: uri, desired: desired, spec: spec);
/// Creates an async WebDriver from existing session using
@@ -52,7 +52,7 @@
Future<core.WebDriver> fromExistingSession(String sessionId,
{Uri uri, core.WebDriverSpec spec = core.WebDriverSpec.Auto}) =>
core.fromExistingSession(
- (prefix) => new AsyncIoRequestClient(prefix), sessionId,
+ (prefix) => AsyncIoRequestClient(prefix), sessionId,
uri: uri, spec: spec);
/// Creates an async WebDriver from existing session with a sync function using
@@ -70,5 +70,5 @@
String sessionId, core.WebDriverSpec spec,
{Uri uri, Map<String, dynamic> capabilities}) =>
core.fromExistingSessionSync(
- (prefix) => new AsyncIoRequestClient(prefix), sessionId, spec,
+ (prefix) => AsyncIoRequestClient(prefix), sessionId, spec,
uri: uri, capabilities: capabilities);
diff --git a/lib/src/async/common.dart b/lib/src/async/common.dart
index 2acb3c6..26f7e9e 100644
--- a/lib/src/async/common.dart
+++ b/lib/src/async/common.dart
@@ -18,7 +18,7 @@
import 'package:webdriver/src/async/web_driver.dart';
import 'package:webdriver/src/async/web_element.dart';
-typedef Future<String> GetAttribute(String name);
+typedef GetAttribute = Future<String> Function(String name);
/// Simple class to provide access to indexed properties such as WebElement
/// attributes or css styles.
diff --git a/lib/src/async/common_io.dart b/lib/src/async/common_io.dart
index 6e7f3b6..941cc18 100644
--- a/lib/src/async/common_io.dart
+++ b/lib/src/async/common_io.dart
@@ -4,9 +4,9 @@
/// Returns a [sync_core.WebDriver] with the same URI + session ID.
sync_core.WebDriver createSyncWebDriver(WebDriver driver) =>
- new sync_core.WebDriver(
+ sync_core.WebDriver(
driver.uri,
driver.id,
driver.capabilities,
- new SyncHttpRequestClient(driver.uri.resolve('session/${driver.id}/')),
+ SyncHttpRequestClient(driver.uri.resolve('session/${driver.id}/')),
driver.spec);
diff --git a/lib/src/async/stepper.dart b/lib/src/async/stepper.dart
index cb8bb42..ba5b425 100644
--- a/lib/src/async/stepper.dart
+++ b/lib/src/async/stepper.dart
@@ -21,5 +21,5 @@
/// returns true if command should be executed, false if should not be executed.
Future<bool> step(String method, String command, params) =>
- new Future.value(true);
+ Future.value(true);
}
diff --git a/lib/src/async/target_locator.dart b/lib/src/async/target_locator.dart
index e89507c..6798b06 100644
--- a/lib/src/async/target_locator.dart
+++ b/lib/src/async/target_locator.dart
@@ -43,7 +43,7 @@
await _client.send(_handler.frame.buildSwitchByElementRequest(frame.id),
_handler.frame.parseSwitchByElementResponse);
} else if (frame is String) {
- final frameId = (await _driver.findElement(new By.id(frame))).id;
+ final frameId = (await _driver.findElement(By.id(frame))).id;
await _client.send(_handler.frame.buildSwitchByElementRequest(frameId),
_handler.frame.parseSwitchByElementResponse);
} else {
@@ -66,7 +66,7 @@
/// instance.
///
/// Throws [NoSuchAlertException] if there is not currently an alert.
- Alert get alert => new Alert(_client, _handler);
+ Alert get alert => Alert(_client, _handler);
@override
String toString() => '$_driver.switchTo';
diff --git a/lib/src/async/web_driver.dart b/lib/src/async/web_driver.dart
index fda2519..ea31f01 100644
--- a/lib/src/async/web_driver.dart
+++ b/lib/src/async/web_driver.dart
@@ -125,10 +125,10 @@
_handler.core.parsePageSourceResponse);
/// Quits the browser.
- Future quit({bool closeSession: true}) => closeSession
+ Future quit({bool closeSession = true}) => closeSession
? _client.send(_handler.core.buildDeleteSessionRequest(),
_handler.core.parseDeleteSessionResponse)
- : new Future.value();
+ : Future.value();
/// Closes the current window.
///
@@ -143,7 +143,7 @@
_handler.window.buildGetWindowsRequest(),
(response) => _handler.window
.parseGetWindowsResponse(response)
- .map<Window>((w) => new Window(_client, _handler, w)));
+ .map<Window>((w) => Window(_client, _handler, w)));
for (final window in windows) {
yield window;
}
@@ -152,7 +152,7 @@
/// Handle for the active tab/window.
Future<Window> get window => _client.send(
_handler.window.buildGetActiveWindowRequest(),
- (response) => new Window(_client, _handler,
+ (response) => Window(_client, _handler,
_handler.window.parseGetActiveWindowResponse(response)));
/// The currently focused element, or the body element if no element has
@@ -168,9 +168,9 @@
}
TargetLocator get switchTo =>
- new TargetLocator(this, this._client, this._handler);
+ TargetLocator(this, this._client, this._handler);
- Cookies get cookies => new Cookies(_client, _handler);
+ Cookies get cookies => Cookies(_client, _handler);
/// [logs.get(logType)] will give list of logs captured in browser.
///
@@ -178,13 +178,13 @@
/// list of logs, as the spec for this in W3C is not agreed on and Firefox
/// refuses to support non-spec features. See
/// https://github.com/w3c/webdriver/issues/406.
- Logs get logs => new Logs(_client, _handler);
+ Logs get logs => Logs(_client, _handler);
- Timeouts get timeouts => new Timeouts(_client, _handler);
+ Timeouts get timeouts => Timeouts(_client, _handler);
- Keyboard get keyboard => new Keyboard(this._client, this._handler);
+ Keyboard get keyboard => Keyboard(this._client, this._handler);
- Mouse get mouse => new Mouse(this._client, this._handler);
+ Mouse get mouse => Mouse(this._client, this._handler);
/// Take a screenshot of the current page as PNG and return it as
/// base64-encoded string.
@@ -205,7 +205,7 @@
/// slow.
@Deprecated('Use captureScreenshotAsBase64 or captureScreenshotAsList!')
Stream<int> captureScreenshot() async* {
- yield* new Stream.fromIterable(await captureScreenshotAsList());
+ yield* Stream.fromIterable(await captureScreenshotAsList());
}
/// Inject a snippet of JavaScript into the page for execution in the context
@@ -264,8 +264,7 @@
response, (elementId) => getElement(elementId, this)));
WebElement getElement(String elementId, [context, locator, index]) =>
- new WebElement(
- this, _client, _handler, elementId, context, locator, index);
+ WebElement(this, _client, _handler, elementId, context, locator, index);
@override
WebDriver get driver => this;
diff --git a/lib/src/async/web_element.dart b/lib/src/async/web_element.dart
index 8830657..c1cb9a5 100644
--- a/lib/src/async/web_element.dart
+++ b/lib/src/async/web_element.dart
@@ -118,7 +118,7 @@
/// Access to the HTML attributes of this tag.
///
/// TODO(DrMarcII): consider special handling of boolean attributes.
- Attributes get attributes => new Attributes((name) => _client.send(
+ Attributes get attributes => Attributes((name) => _client.send(
_handler.element.buildAttributeRequest(id, name),
_handler.element.parseAttributeResponse));
@@ -126,12 +126,12 @@
///
/// This is deprecated, only used to support old pageloader.
@deprecated
- Attributes get seleniumAttributes => new Attributes((name) => _client.send(
+ Attributes get seleniumAttributes => Attributes((name) => _client.send(
_handler.element.buildSeleniumAttributeRequest(id, name),
_handler.element.parseSeleniumAttributeResponse));
/// Access to the HTML properties of this tag.
- Attributes get properties => new Attributes((name) => _client.send(
+ Attributes get properties => Attributes((name) => _client.send(
_handler.element.buildPropertyRequest(id, name),
_handler.element.parsePropertyResponse));
@@ -139,7 +139,7 @@
///
/// TODO(DrMarcII): consider special handling of color and possibly other
/// properties.
- Attributes get cssProperties => new Attributes((name) => _client.send(
+ Attributes get cssProperties => Attributes((name) => _client.send(
_handler.element.buildCssPropertyRequest(id, name),
_handler.element.parseCssPropertyResponse));
@@ -155,7 +155,7 @@
@override
String toString() {
- var out = new StringBuffer()..write(context);
+ var out = StringBuffer()..write(context);
if (locator is By) {
if (index == null) {
out..write('.findElement(');
diff --git a/lib/src/async/window.dart b/lib/src/async/window.dart
index de18675..31452aa 100644
--- a/lib/src/async/window.dart
+++ b/lib/src/async/window.dart
@@ -54,8 +54,7 @@
// Delegate to other methods.
final location = await this.location;
final size = await this.size;
- return new Rectangle<int>(
- location.x, location.y, size.width, size.height);
+ return Rectangle<int>(location.x, location.y, size.width, size.height);
}
}
@@ -79,7 +78,7 @@
// JsonWire cannot implement this API in one call.
// Delegate to other methods.
await setLocation(rect.topLeft);
- await setSize(new Rectangle(0, 0, rect.width, rect.height));
+ await setSize(Rectangle(0, 0, rect.width, rect.height));
}
}
diff --git a/lib/src/common/capabilities.dart b/lib/src/common/capabilities.dart
index 46cbaad..5abca67 100644
--- a/lib/src/common/capabilities.dart
+++ b/lib/src/common/capabilities.dart
@@ -56,13 +56,13 @@
static const String enableProfiling = 'webdriver.logging.profiler.enabled';
static Map<String, dynamic> get chrome =>
- new Map.from(empty)..[browserName] = Browser.chrome;
+ Map.from(empty)..[browserName] = Browser.chrome;
static Map<String, dynamic> get firefox =>
- new Map.from(empty)..[browserName] = Browser.firefox;
+ Map.from(empty)..[browserName] = Browser.firefox;
static Map<String, dynamic> get android =>
- new Map.from(empty)..[browserName] = Browser.android;
+ Map.from(empty)..[browserName] = Browser.android;
static Map<String, dynamic> get empty => <String, dynamic>{};
}
diff --git a/lib/src/common/cookie.dart b/lib/src/common/cookie.dart
index e38f59f..7a1a298 100644
--- a/lib/src/common/cookie.dart
+++ b/lib/src/common/cookie.dart
@@ -38,11 +38,11 @@
factory Cookie.fromJson(Map<String, dynamic> json) {
DateTime expiry;
if (json['expiry'] is num) {
- expiry = new DateTime.fromMillisecondsSinceEpoch(
+ expiry = DateTime.fromMillisecondsSinceEpoch(
json['expiry'].toInt() * 1000,
isUtc: true);
}
- return new Cookie(json['name'], json['value'],
+ return Cookie(json['name'], json['value'],
path: json['path'],
domain: json['domain'],
secure: json['secure'],
diff --git a/lib/src/common/exception.dart b/lib/src/common/exception.dart
index 9ed81d5..28c3fec 100644
--- a/lib/src/common/exception.dart
+++ b/lib/src/common/exception.dart
@@ -214,63 +214,62 @@
switch (status) {
case 0:
- throw new StateError(
- 'Not a WebDriverError Status: 0 Message: $message');
+ throw StateError('Not a WebDriverError Status: 0 Message: $message');
case 6: // NoSuchDriver
- return new NoSuchDriverException(status, message);
+ return NoSuchDriverException(status, message);
case 7: // NoSuchElement
- return new NoSuchElementException(status, message);
+ return NoSuchElementException(status, message);
case 8: // NoSuchFrame
- return new NoSuchFrameException(status, message);
+ return NoSuchFrameException(status, message);
case 9: // UnknownCommand
- return new UnknownCommandException(status, message);
+ return UnknownCommandException(status, message);
case 10: // StaleElementReferenceException
- return new StaleElementReferenceException(status, message);
+ return StaleElementReferenceException(status, message);
case 11: // ElementNotVisible
- return new ElementNotVisibleException(status, message);
+ return ElementNotVisibleException(status, message);
case 12: // InvalidElementState
- return new InvalidElementStateException(status, message);
+ return InvalidElementStateException(status, message);
case 15: // ElementIsNotSelectable
- return new ElementIsNotSelectableException(status, message);
+ return ElementIsNotSelectableException(status, message);
case 17: // JavaScriptError
- return new JavaScriptException(status, message);
+ return JavaScriptException(status, message);
case 19: // XPathLookupError
- return new XPathLookupException(status, message);
+ return XPathLookupException(status, message);
case 21: // Timeout
- return new TimeoutException(status, message);
+ return TimeoutException(status, message);
case 23: // NoSuchWindow
- return new NoSuchWindowException(status, message);
+ return NoSuchWindowException(status, message);
case 24: // InvalidCookieDomain
- return new InvalidCookieDomainException(status, message);
+ return InvalidCookieDomainException(status, message);
case 25: // UnableToSetCookie
- return new UnableToSetCookieException(status, message);
+ return UnableToSetCookieException(status, message);
case 26: // UnexpectedAlertOpen
- return new UnexpectedAlertOpenException(status, message);
+ return UnexpectedAlertOpenException(status, message);
case 27: // NoSuchAlert
- return new NoSuchAlertException(status, message);
+ return NoSuchAlertException(status, message);
case 28: // ScriptTimeout
- return new ScriptTimeoutException(status, message);
+ return ScriptTimeoutException(status, message);
case 29: // InvalidElementCoordinates
- return new InvalidElementCoordinatesException(status, message);
+ return InvalidElementCoordinatesException(status, message);
case 30: // IMENotAvailable
- return new IMENotAvailableException(status, message);
+ return IMENotAvailableException(status, message);
case 31: // IMEEngineActivationFailed
- return new IMEEngineActivationFailedException(status, message);
+ return IMEEngineActivationFailedException(status, message);
case 32: // InvalidSelector
- return new InvalidSelectorException(status, message);
+ return InvalidSelectorException(status, message);
case 33: // SessionNotCreatedException
- return new SessionNotCreatedException(status, message);
+ return SessionNotCreatedException(status, message);
case 34: // MoveTargetOutOfBounds
- return new MoveTargetOutOfBoundsException(status, message);
+ return MoveTargetOutOfBoundsException(status, message);
case 13: // UnknownError
default: // new error?
- return new UnknownException(status, message);
+ return UnknownException(status, message);
}
}
if (jsonResp != null) {
- return new InvalidRequestException(httpStatusCode, jsonResp);
+ return InvalidRequestException(httpStatusCode, jsonResp);
}
- return new InvalidRequestException(httpStatusCode, httpReasonPhrase);
+ return InvalidRequestException(httpStatusCode, httpReasonPhrase);
}
/// Temporary method to emulate the original w3c exception parsing logic.
@@ -281,13 +280,13 @@
switch (value['error']) {
case 'invalid argument':
- return new InvalidArgumentException(httpStatusCode, value['message']);
+ return InvalidArgumentException(httpStatusCode, value['message']);
case 'no such element':
- return new NoSuchElementException(httpStatusCode, value['message']);
+ return NoSuchElementException(httpStatusCode, value['message']);
default:
- return new WebDriverException(httpStatusCode, value['message']);
+ return WebDriverException(httpStatusCode, value['message']);
}
}
- return new InvalidResponseException(httpStatusCode, jsonResp.toString());
+ return InvalidResponseException(httpStatusCode, jsonResp.toString());
}
diff --git a/lib/src/common/log.dart b/lib/src/common/log.dart
index ca44d71..7785b9f 100644
--- a/lib/src/common/log.dart
+++ b/lib/src/common/log.dart
@@ -8,7 +8,7 @@
LogEntry.fromMap(Map map)
: this(
map['message'],
- new DateTime.fromMillisecondsSinceEpoch(map['timestamp'].toInt(),
+ DateTime.fromMillisecondsSinceEpoch(map['timestamp'].toInt(),
isUtc: true),
map['level']);
diff --git a/lib/src/common/mouse.dart b/lib/src/common/mouse.dart
index 3095c38..16e449a 100644
--- a/lib/src/common/mouse.dart
+++ b/lib/src/common/mouse.dart
@@ -7,21 +7,21 @@
/// The primary button is usually the left button or the only button on
/// single-button devices, used to activate a user interface control or select
/// text.
- static const MouseButton primary = const MouseButton(0);
+ static const MouseButton primary = MouseButton(0);
/// The auxiliary button is usually the middle button, often combined with a
/// mouse wheel.
- static const MouseButton auxiliary = const MouseButton(1);
+ static const MouseButton auxiliary = MouseButton(1);
/// The secondary button is usually the right button, often used to display a
/// context menu.
- static const MouseButton secondary = const MouseButton(2);
+ static const MouseButton secondary = MouseButton(2);
/// Optional button to fire back action on a mouse. Defined in W3C.
- static const MouseButton x1 = const MouseButton(3);
+ static const MouseButton x1 = MouseButton(3);
/// Optional button to fire forward action on a mouse. Defined in W3C.
- static const MouseButton x2 = const MouseButton(4);
+ static const MouseButton x2 = MouseButton(4);
final int value;
diff --git a/lib/src/common/request.dart b/lib/src/common/request.dart
index df95428..181a169 100644
--- a/lib/src/common/request.dart
+++ b/lib/src/common/request.dart
@@ -8,9 +8,9 @@
@override
String toString() => 'HttpMethod.$name';
- static const httpGet = const HttpMethod._('GET');
- static const httpPost = const HttpMethod._('POST');
- static const httpDelete = const HttpMethod._('DELETE');
+ static const httpGet = HttpMethod._('GET');
+ static const httpPost = HttpMethod._('POST');
+ static const httpDelete = HttpMethod._('DELETE');
}
/// Request data to send to WebDriver.
diff --git a/lib/src/common/request_client.dart b/lib/src/common/request_client.dart
index 18108c6..46be7ab 100644
--- a/lib/src/common/request_client.dart
+++ b/lib/src/common/request_client.dart
@@ -11,15 +11,14 @@
RequestClient(this._prefix);
- Uri resolve(String command) => _prefix.resolve(command.isEmpty
- ? _prefix.path.replaceFirst(new RegExp('/\$'), '')
- : command);
+ Uri resolve(String command) => _prefix.resolve(
+ command.isEmpty ? _prefix.path.replaceFirst(RegExp('/\$'), '') : command);
@override
String toString() => _prefix.toString();
}
-typedef void SyncWebDriverListener(WebDriverCommandEvent event);
+typedef SyncWebDriverListener = void Function(WebDriverCommandEvent event);
/// Sync client to send to and receive from WebDriver.
abstract class SyncRequestClient extends RequestClient {
@@ -33,11 +32,11 @@
T send<T>(WebDriverRequest request, T Function(WebDriverResponse) process) {
if (request.method == null) {
- return process(new WebDriverResponse(200, null, request.body));
+ return process(WebDriverResponse(200, null, request.body));
}
- final startTime = new DateTime.now();
- var trace = new Chain.current();
+ final startTime = DateTime.now();
+ var trace = Chain.current();
trace = trace.foldFrames((f) => f.library.startsWith('package:webdriver/'),
terse: true);
@@ -50,12 +49,12 @@
exception = e;
rethrow;
} finally {
- final event = new WebDriverCommandEvent(
+ final event = WebDriverCommandEvent(
method: request.method.name,
endPoint: resolve(request.uri).toString(),
params: request.body,
startTime: startTime,
- endTime: new DateTime.now(),
+ endTime: DateTime.now(),
exception: exception,
result: response,
stackTrace: trace);
@@ -68,7 +67,7 @@
WebDriverResponse sendRaw(WebDriverRequest request);
}
-typedef Future AsyncWebDriverListener(WebDriverCommandEvent event);
+typedef AsyncWebDriverListener = Future Function(WebDriverCommandEvent event);
/// Async client to send to and receive from WebDriver.
abstract class AsyncRequestClient extends RequestClient {
@@ -83,11 +82,11 @@
Future<T> send<T>(
WebDriverRequest request, T Function(WebDriverResponse) process) async {
if (request.method == null) {
- return process(new WebDriverResponse(200, null, request.body));
+ return process(WebDriverResponse(200, null, request.body));
}
- final startTime = new DateTime.now();
- var trace = new Chain.current();
+ final startTime = DateTime.now();
+ var trace = Chain.current();
trace = trace.foldFrames((f) => f.library.startsWith('package:webdriver/'),
terse: true);
@@ -100,12 +99,12 @@
exception = e;
rethrow;
} finally {
- final event = new WebDriverCommandEvent(
+ final event = WebDriverCommandEvent(
method: request.method.name,
endPoint: resolve(request.uri).toString(),
params: request.body,
startTime: startTime,
- endTime: new DateTime.now(),
+ endTime: DateTime.now(),
exception: exception,
result: response,
stackTrace: trace);
diff --git a/lib/src/common/utils.dart b/lib/src/common/utils.dart
index 294bb5c..1221929 100644
--- a/lib/src/common/utils.dart
+++ b/lib/src/common/utils.dart
@@ -7,12 +7,12 @@
WebDriverHandler getHandler(WebDriverSpec spec) {
switch (spec) {
case WebDriverSpec.JsonWire:
- return new JsonWireWebDriverHandler();
+ return JsonWireWebDriverHandler();
case WebDriverSpec.W3c:
- return new W3cWebDriverHandler();
+ return W3cWebDriverHandler();
case WebDriverSpec.Auto:
- return new InferWebDriverHandler();
+ return InferWebDriverHandler();
default:
- throw new UnsupportedError('Unexpected web driver spec: $spec.');
+ throw UnsupportedError('Unexpected web driver spec: $spec.');
}
}
diff --git a/lib/src/common/webdriver_handler.dart b/lib/src/common/webdriver_handler.dart
index 7f55027..44901e9 100644
--- a/lib/src/common/webdriver_handler.dart
+++ b/lib/src/common/webdriver_handler.dart
@@ -272,7 +272,7 @@
/// Builds request for 'Mouse Move To'.
WebDriverRequest buildMoveToRequest(
- {String elementId, int xOffset, int yOffset, bool absolute: false});
+ {String elementId, int xOffset, int yOffset, bool absolute = false});
/// Parses response for 'Mouse Move To'.
void parseMoveToResponse(WebDriverResponse response);
diff --git a/lib/src/handler/infer_handler.dart b/lib/src/handler/infer_handler.dart
index 7970349..ad81379 100644
--- a/lib/src/handler/infer_handler.dart
+++ b/lib/src/handler/infer_handler.dart
@@ -13,71 +13,71 @@
/// getting existing session info without given the spec.
class InferWebDriverHandler extends WebDriverHandler {
@override
- final SessionHandler session = new InferSessionHandler();
+ final SessionHandler session = InferSessionHandler();
@override
CoreHandler get core =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
ElementHandler get element =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
ElementFinder get elementFinder =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
KeyboardHandler get keyboard =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
MouseHandler get mouse =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
AlertHandler get alert =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
NavigationHandler get navigation =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
WindowHandler get window =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
FrameHandler get frame =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
CookiesHandler get cookies =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
TimeoutsHandler get timeouts =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
LogsHandler get logs =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
WebDriverRequest buildGeneralRequest(HttpMethod method, String uri,
[params]) =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
@override
dynamic parseGeneralResponse(
WebDriverResponse response, dynamic Function(String) createElement) =>
- throw new UnsupportedError('Unsupported for InferHandler');
+ throw UnsupportedError('Unsupported for InferHandler');
}
class InferSessionHandler extends SessionHandler {
@override
WebDriverRequest buildCreateRequest({Map<String, dynamic> desired}) =>
- new WebDriverRequest.postRequest('session', {
+ WebDriverRequest.postRequest('session', {
'desiredCapabilities': desired,
'capabilities': {'alwaysMatch': desired}
});
@@ -91,25 +91,25 @@
final rawBody = response.body == null || response.body.isEmpty
? '<empty response>'
: response.body;
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode, 'Error parsing response body: $rawBody');
}
// JSON responses have multiple keys.
if (responseBody.keys.length > 1) {
- return new JsonWireSessionHandler().parseCreateResponse(response);
+ return JsonWireSessionHandler().parseCreateResponse(response);
// W3C responses have only one key, value.
} else if (responseBody.keys.length == 1) {
- return new W3cSessionHandler().parseCreateResponse(response);
+ return W3cSessionHandler().parseCreateResponse(response);
}
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode, 'Unexpected response structure: ${response.body}');
}
@override
WebDriverRequest buildInfoRequest(String id) =>
- new WebDriverRequest.getRequest('session/$id');
+ WebDriverRequest.getRequest('session/$id');
@override
SessionInfo parseInfoResponse(WebDriverResponse response) {
@@ -122,25 +122,25 @@
final rawBody = response.body == null || response.body.isEmpty
? '<empty response>'
: response.body;
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode, 'Error parsing response body: $rawBody');
}
if (body == null ||
body['error'] != 'unknown command' ||
body['message'] is! String) {
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode,
'Unexpected response body (expecting `unexpected command error` '
'produced by W3C WebDriver): ${response.body}');
}
- final sessionId = new RegExp(r'/session/([0-9a-f-]*) ')
+ final sessionId = RegExp(r'/session/([0-9a-f-]*) ')
.firstMatch(body['message'] as String)
.group(1);
- return new SessionInfo(sessionId, WebDriverSpec.W3c, Capabilities.empty);
+ return SessionInfo(sessionId, WebDriverSpec.W3c, Capabilities.empty);
}
- return new JsonWireSessionHandler().parseInfoResponse(response);
+ return JsonWireSessionHandler().parseInfoResponse(response);
}
}
diff --git a/lib/src/handler/json_wire/alert.dart b/lib/src/handler/json_wire/alert.dart
index 2b8e818..a9f8873 100644
--- a/lib/src/handler/json_wire/alert.dart
+++ b/lib/src/handler/json_wire/alert.dart
@@ -19,7 +19,7 @@
class JsonWireAlertHandler implements AlertHandler {
@override
WebDriverRequest buildGetTextRequest() =>
- new WebDriverRequest.getRequest('alert_text');
+ WebDriverRequest.getRequest('alert_text');
@override
String parseGetTextResponse(WebDriverResponse response) =>
@@ -27,7 +27,7 @@
@override
WebDriverRequest buildAcceptRequest() =>
- new WebDriverRequest.postRequest('accept_alert');
+ WebDriverRequest.postRequest('accept_alert');
@override
void parseAcceptResponse(WebDriverResponse response) {
@@ -36,7 +36,7 @@
@override
WebDriverRequest buildDismissRequest() =>
- new WebDriverRequest.postRequest('dismiss_alert');
+ WebDriverRequest.postRequest('dismiss_alert');
@override
void parseDismissResponse(WebDriverResponse response) {
@@ -45,7 +45,7 @@
@override
WebDriverRequest buildSendTextRequest(String keysToSend) =>
- new WebDriverRequest.postRequest('alert_text', {'text': keysToSend});
+ WebDriverRequest.postRequest('alert_text', {'text': keysToSend});
@override
void parseSendTextResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/json_wire/cookies.dart b/lib/src/handler/json_wire/cookies.dart
index f83507f..51a8461 100644
--- a/lib/src/handler/json_wire/cookies.dart
+++ b/lib/src/handler/json_wire/cookies.dart
@@ -21,8 +21,7 @@
class JsonWireCookiesHandler extends CookiesHandler {
@override
WebDriverRequest buildAddCookieRequest(Cookie cookie) =>
- new WebDriverRequest.postRequest(
- 'cookie', {'cookie': _serialize(cookie)});
+ WebDriverRequest.postRequest('cookie', {'cookie': _serialize(cookie)});
@override
void parseAddCookieResponse(WebDriverResponse response) {
@@ -31,7 +30,7 @@
@override
WebDriverRequest buildDeleteCookieRequest(String name) =>
- new WebDriverRequest.deleteRequest('cookie/$name');
+ WebDriverRequest.deleteRequest('cookie/$name');
@override
void parseDeleteCookieResponse(WebDriverResponse response) {
@@ -40,7 +39,7 @@
@override
WebDriverRequest buildDeleteAllCookiesRequest() =>
- new WebDriverRequest.deleteRequest('cookie');
+ WebDriverRequest.deleteRequest('cookie');
@override
void parseDeleteAllCookiesResponse(WebDriverResponse response) {
@@ -57,11 +56,11 @@
Cookie parseGetCookieResponse(WebDriverResponse response, String name) =>
parseGetAllCookiesResponse(response).firstWhere((c) => c.name == name,
orElse: () =>
- throw new NoSuchCookieException(0, 'Cookie $name is not found.'));
+ throw NoSuchCookieException(0, 'Cookie $name is not found.'));
@override
WebDriverRequest buildGetAllCookiesRequest() =>
- new WebDriverRequest.getRequest('cookie');
+ WebDriverRequest.getRequest('cookie');
@override
List<Cookie> parseGetAllCookiesResponse(WebDriverResponse response) =>
@@ -75,5 +74,5 @@
/// Deserializes the json object to get the cookie according to the spec.
///
/// The spec is deserializing the same we do in [Cookie.fromJson].
- Cookie _deserialize(dynamic content) => new Cookie.fromJson(content);
+ Cookie _deserialize(dynamic content) => Cookie.fromJson(content);
}
diff --git a/lib/src/handler/json_wire/core.dart b/lib/src/handler/json_wire/core.dart
index a775a67..3485e65 100644
--- a/lib/src/handler/json_wire/core.dart
+++ b/lib/src/handler/json_wire/core.dart
@@ -5,15 +5,14 @@
class JsonWireCoreHandler extends CoreHandler {
@override
WebDriverRequest buildCurrentUrlRequest() =>
- new WebDriverRequest.getRequest('url');
+ WebDriverRequest.getRequest('url');
@override
String parseCurrentUrlResponse(WebDriverResponse response) =>
parseJsonWireResponse(response);
@override
- WebDriverRequest buildTitleRequest() =>
- new WebDriverRequest.getRequest('title');
+ WebDriverRequest buildTitleRequest() => WebDriverRequest.getRequest('title');
@override
String parseTitleResponse(WebDriverResponse response) =>
@@ -21,7 +20,7 @@
@override
WebDriverRequest buildPageSourceRequest() =>
- new WebDriverRequest.getRequest('source');
+ WebDriverRequest.getRequest('source');
@override
String parsePageSourceResponse(WebDriverResponse response) =>
@@ -29,7 +28,7 @@
@override
WebDriverRequest buildScreenshotRequest() =>
- new WebDriverRequest.getRequest('screenshot');
+ WebDriverRequest.getRequest('screenshot');
@override
String parseScreenshotResponse(WebDriverResponse response) =>
@@ -37,7 +36,7 @@
@override
WebDriverRequest buildExecuteAsyncRequest(String script, List args) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'execute_async', {'script': script, 'args': serialize(args)});
@override
@@ -47,7 +46,7 @@
@override
WebDriverRequest buildExecuteRequest(String script, List args) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'execute', {'script': script, 'args': serialize(args)});
@override
@@ -57,7 +56,7 @@
@override
WebDriverRequest buildDeleteSessionRequest() =>
- new WebDriverRequest.deleteRequest('');
+ WebDriverRequest.deleteRequest('');
@override
void parseDeleteSessionResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/json_wire/element.dart b/lib/src/handler/json_wire/element.dart
index e807a1e..ebafb10 100644
--- a/lib/src/handler/json_wire/element.dart
+++ b/lib/src/handler/json_wire/element.dart
@@ -8,7 +8,7 @@
class JsonWireElementHandler extends ElementHandler {
@override
WebDriverRequest buildClickRequest(String elementId) {
- return new WebDriverRequest.postRequest('${elementPrefix(elementId)}click');
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}click');
}
@override
@@ -18,8 +18,7 @@
@override
WebDriverRequest buildSendKeysRequest(String elementId, String keysToSend) {
- return new WebDriverRequest.postRequest(
- '${elementPrefix(elementId)}value', {
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}value', {
'value': [keysToSend]
});
}
@@ -31,7 +30,7 @@
@override
WebDriverRequest buildClearRequest(String elementId) {
- return new WebDriverRequest.postRequest('${elementPrefix(elementId)}clear');
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}clear');
}
@override
@@ -77,7 +76,7 @@
@override
Point<int> parseLocationResponse(WebDriverResponse response) {
final point = parseJsonWireResponse(response);
- return new Point(point['x'].toInt(), point['y'].toInt());
+ return Point(point['x'].toInt(), point['y'].toInt());
}
@override
@@ -88,8 +87,7 @@
@override
Rectangle<int> parseSizeResponse(WebDriverResponse response) {
final size = parseJsonWireResponse(response);
- return new Rectangle<int>(
- 0, 0, size['width'].toInt(), size['height'].toInt());
+ return Rectangle<int>(0, 0, size['width'].toInt(), size['height'].toInt());
}
@override
@@ -180,6 +178,6 @@
}
/// Convert hyphenated-properties to camelCase.
- String _cssPropName(String name) => name.splitMapJoin(new RegExp(r'-(\w)'),
+ String _cssPropName(String name) => name.splitMapJoin(RegExp(r'-(\w)'),
onMatch: (m) => m.group(1).toUpperCase(), onNonMatch: (m) => m);
}
diff --git a/lib/src/handler/json_wire/element_finder.dart b/lib/src/handler/json_wire/element_finder.dart
index 60f0464..722dc3f 100644
--- a/lib/src/handler/json_wire/element_finder.dart
+++ b/lib/src/handler/json_wire/element_finder.dart
@@ -13,7 +13,7 @@
String uri = contextElementId == null
? 'elements'
: 'element/$contextElementId/elements';
- return new WebDriverRequest.postRequest(uri, _byToJson(by));
+ return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@override
@@ -29,7 +29,7 @@
String uri = contextElementId == null
? 'element'
: 'element/$contextElementId/element';
- return new WebDriverRequest.postRequest(uri, _byToJson(by));
+ return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@override
@@ -39,7 +39,7 @@
@override
WebDriverRequest buildFindActiveElementRequest() {
- return new WebDriverRequest.getRequest('element/active');
+ return WebDriverRequest.getRequest('element/active');
}
@override
diff --git a/lib/src/handler/json_wire/frame.dart b/lib/src/handler/json_wire/frame.dart
index 47ee160..d7c3f72 100644
--- a/lib/src/handler/json_wire/frame.dart
+++ b/lib/src/handler/json_wire/frame.dart
@@ -19,7 +19,7 @@
class JsonWireFrameHandler extends FrameHandler {
@override
WebDriverRequest buildSwitchByIdRequest([int id]) =>
- new WebDriverRequest.postRequest('frame', {'id': id});
+ WebDriverRequest.postRequest('frame', {'id': id});
@override
void parseSwitchByIdResponse(WebDriverResponse response) {
@@ -28,7 +28,7 @@
@override
WebDriverRequest buildSwitchByElementRequest(String elementId) =>
- new WebDriverRequest.postRequest('frame', {
+ WebDriverRequest.postRequest('frame', {
'id': {jsonWireElementStr: elementId}
});
@@ -39,7 +39,7 @@
@override
WebDriverRequest buildSwitchToParentRequest() =>
- new WebDriverRequest.postRequest('frame/parent');
+ WebDriverRequest.postRequest('frame/parent');
@override
void parseSwitchToParentResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/json_wire/keyboard.dart b/lib/src/handler/json_wire/keyboard.dart
index 3d9bc49..b4f3a93 100644
--- a/lib/src/handler/json_wire/keyboard.dart
+++ b/lib/src/handler/json_wire/keyboard.dart
@@ -12,7 +12,7 @@
@override
WebDriverRequest buildSendKeysRequest(String keysToSend) {
- return new WebDriverRequest.postRequest('keys', {
+ return WebDriverRequest.postRequest('keys', {
'value': [keysToSend]
});
}
@@ -23,7 +23,7 @@
}
String _createChord(Iterable<String> chord) {
- StringBuffer chordString = new StringBuffer();
+ StringBuffer chordString = StringBuffer();
for (String s in chord) {
chordString.write(s);
}
diff --git a/lib/src/handler/json_wire/logs.dart b/lib/src/handler/json_wire/logs.dart
index 34e3a6d..55f743a 100644
--- a/lib/src/handler/json_wire/logs.dart
+++ b/lib/src/handler/json_wire/logs.dart
@@ -20,11 +20,11 @@
class JsonWireLogsHandler extends LogsHandler {
@override
WebDriverRequest buildGetLogsRequest(String logType) =>
- new WebDriverRequest.postRequest('log', {'type': logType});
+ WebDriverRequest.postRequest('log', {'type': logType});
@override
List<LogEntry> parseGetLogsResponse(WebDriverResponse response) =>
parseJsonWireResponse(response)
- .map<LogEntry>((e) => new LogEntry.fromMap(e))
+ .map<LogEntry>((e) => LogEntry.fromMap(e))
.toList();
}
diff --git a/lib/src/handler/json_wire/mouse.dart b/lib/src/handler/json_wire/mouse.dart
index e96e668..bf55f9d 100644
--- a/lib/src/handler/json_wire/mouse.dart
+++ b/lib/src/handler/json_wire/mouse.dart
@@ -8,7 +8,7 @@
@override
WebDriverRequest buildClickRequest(
[MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('click', {'button': button.value});
+ WebDriverRequest.postRequest('click', {'button': button.value});
@override
void parseClickResponse(WebDriverResponse response) {
@@ -18,7 +18,7 @@
@override
WebDriverRequest buildDownRequest(
[MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('buttondown', {'button': button.value});
+ WebDriverRequest.postRequest('buttondown', {'button': button.value});
@override
void parseDownResponse(WebDriverResponse response) {
@@ -27,7 +27,7 @@
@override
WebDriverRequest buildUpRequest([MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('buttonup', {'button': button.value});
+ WebDriverRequest.postRequest('buttonup', {'button': button.value});
@override
void parseUpResponse(WebDriverResponse response) {
@@ -36,7 +36,7 @@
@override
WebDriverRequest buildDoubleClickRequest() =>
- new WebDriverRequest.postRequest('doubleclick');
+ WebDriverRequest.postRequest('doubleclick');
@override
void parseDoubleClickResponse(WebDriverResponse response) {
@@ -45,9 +45,9 @@
@override
WebDriverRequest buildMoveToRequest(
- {String elementId, int xOffset, int yOffset, bool absolute: false}) {
+ {String elementId, int xOffset, int yOffset, bool absolute = false}) {
if (absolute) {
- throw new InvalidArgumentException(
+ throw InvalidArgumentException(
0, 'Move to an absolute location is only supported in W3C spec.');
}
@@ -61,7 +61,7 @@
body['yoffset'] = yOffset.floor();
}
- return new WebDriverRequest.postRequest('moveto', body);
+ return WebDriverRequest.postRequest('moveto', body);
}
@override
diff --git a/lib/src/handler/json_wire/navigation.dart b/lib/src/handler/json_wire/navigation.dart
index 7a4c3d1..e481405 100644
--- a/lib/src/handler/json_wire/navigation.dart
+++ b/lib/src/handler/json_wire/navigation.dart
@@ -19,7 +19,7 @@
class JsonWireNavigationHandler extends NavigationHandler {
@override
WebDriverRequest buildNavigateToRequest(String url) =>
- new WebDriverRequest.postRequest('url', {'url': url});
+ WebDriverRequest.postRequest('url', {'url': url});
@override
void parseNavigateToResponse(WebDriverResponse response) {
@@ -28,7 +28,7 @@
@override
WebDriverRequest buildForwardRequest() =>
- new WebDriverRequest.postRequest('forward');
+ WebDriverRequest.postRequest('forward');
@override
void parseForwardResponse(WebDriverResponse response) {
@@ -36,8 +36,7 @@
}
@override
- WebDriverRequest buildBackRequest() =>
- new WebDriverRequest.postRequest('back');
+ WebDriverRequest buildBackRequest() => WebDriverRequest.postRequest('back');
@override
void parseBackResponse(WebDriverResponse response) {
@@ -46,7 +45,7 @@
@override
WebDriverRequest buildRefreshRequest() =>
- new WebDriverRequest.postRequest('refresh');
+ WebDriverRequest.postRequest('refresh');
@override
void parseRefreshResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/json_wire/session.dart b/lib/src/handler/json_wire/session.dart
index 500cb40..3b043f4 100644
--- a/lib/src/handler/json_wire/session.dart
+++ b/lib/src/handler/json_wire/session.dart
@@ -9,7 +9,7 @@
@override
WebDriverRequest buildCreateRequest({Map<String, dynamic> desired}) {
desired ??= Capabilities.empty;
- return new WebDriverRequest.postRequest(
+ return WebDriverRequest.postRequest(
'session', {'desiredCapabilities': desired});
}
@@ -19,12 +19,12 @@
@override
WebDriverRequest buildInfoRequest(String id) =>
- new WebDriverRequest.getRequest('session/$id');
+ WebDriverRequest.getRequest('session/$id');
@override
SessionInfo parseInfoResponse(WebDriverResponse response) {
final session = parseJsonWireResponse(response, valueOnly: false);
- return new SessionInfo(
+ return SessionInfo(
session['sessionId'], WebDriverSpec.JsonWire, session['value']);
}
}
diff --git a/lib/src/handler/json_wire/timeouts.dart b/lib/src/handler/json_wire/timeouts.dart
index 2f005ae..9ae177c 100644
--- a/lib/src/handler/json_wire/timeouts.dart
+++ b/lib/src/handler/json_wire/timeouts.dart
@@ -18,7 +18,7 @@
class JsonWireTimeoutsHandler extends TimeoutsHandler {
WebDriverRequest _buildSetTimeoutRequest(String type, Duration timeout) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'timeouts', {'type': type, 'ms': timeout.inMilliseconds});
@override
diff --git a/lib/src/handler/json_wire/utils.dart b/lib/src/handler/json_wire/utils.dart
index ec8eef7..afa3bf3 100644
--- a/lib/src/handler/json_wire/utils.dart
+++ b/lib/src/handler/json_wire/utils.dart
@@ -18,7 +18,7 @@
final rawBody = response.body == null || response.body.isEmpty
? '<empty response>'
: response.body;
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode, 'Error parsing response body: $rawBody');
}
@@ -32,58 +32,57 @@
switch (status) {
case 0:
- throw new StateError(
- 'Not a WebDriverError Status: 0 Message: $message');
+ throw StateError('Not a WebDriverError Status: 0 Message: $message');
case 6:
- throw new NoSuchDriverException(status, message);
+ throw NoSuchDriverException(status, message);
case 7:
- throw new NoSuchElementException(status, message);
+ throw NoSuchElementException(status, message);
case 8:
- throw new NoSuchFrameException(status, message);
+ throw NoSuchFrameException(status, message);
case 9:
- throw new UnknownCommandException(status, message);
+ throw UnknownCommandException(status, message);
case 10:
- throw new StaleElementReferenceException(status, message);
+ throw StaleElementReferenceException(status, message);
case 11:
- throw new ElementNotVisibleException(status, message);
+ throw ElementNotVisibleException(status, message);
case 12:
- throw new InvalidElementStateException(status, message);
+ throw InvalidElementStateException(status, message);
case 15:
- throw new ElementIsNotSelectableException(status, message);
+ throw ElementIsNotSelectableException(status, message);
case 17:
- throw new JavaScriptException(status, message);
+ throw JavaScriptException(status, message);
case 19:
- throw new XPathLookupException(status, message);
+ throw XPathLookupException(status, message);
case 21:
- throw new TimeoutException(status, message);
+ throw TimeoutException(status, message);
case 23:
- throw new NoSuchWindowException(status, message);
+ throw NoSuchWindowException(status, message);
case 24:
- throw new InvalidCookieDomainException(status, message);
+ throw InvalidCookieDomainException(status, message);
case 25:
- throw new UnableToSetCookieException(status, message);
+ throw UnableToSetCookieException(status, message);
case 26:
- throw new UnexpectedAlertOpenException(status, message);
+ throw UnexpectedAlertOpenException(status, message);
case 27:
- throw new NoSuchAlertException(status, message);
+ throw NoSuchAlertException(status, message);
case 28:
- throw new ScriptTimeoutException(status, message);
+ throw ScriptTimeoutException(status, message);
case 29:
- throw new InvalidElementCoordinatesException(status, message);
+ throw InvalidElementCoordinatesException(status, message);
case 30:
- throw new IMENotAvailableException(status, message);
+ throw IMENotAvailableException(status, message);
case 31:
- throw new IMEEngineActivationFailedException(status, message);
+ throw IMEEngineActivationFailedException(status, message);
case 32:
- throw new InvalidSelectorException(status, message);
+ throw InvalidSelectorException(status, message);
case 33:
- throw new SessionNotCreatedException(status, message);
+ throw SessionNotCreatedException(status, message);
case 34:
- throw new MoveTargetOutOfBoundsException(status, message);
+ throw MoveTargetOutOfBoundsException(status, message);
case 13:
- throw new UnknownException(status, message);
+ throw UnknownException(status, message);
default:
- throw new WebDriverException(status, message);
+ throw WebDriverException(status, message);
}
}
diff --git a/lib/src/handler/json_wire/window.dart b/lib/src/handler/json_wire/window.dart
index 46640d0..323d2ce 100644
--- a/lib/src/handler/json_wire/window.dart
+++ b/lib/src/handler/json_wire/window.dart
@@ -21,7 +21,7 @@
class JsonWireWindowHandler extends WindowHandler {
@override
WebDriverRequest buildGetWindowsRequest() =>
- new WebDriverRequest.getRequest('window_handles');
+ WebDriverRequest.getRequest('window_handles');
@override
List<String> parseGetWindowsResponse(WebDriverResponse response) =>
@@ -29,7 +29,7 @@
@override
WebDriverRequest buildGetActiveWindowRequest() =>
- new WebDriverRequest.getRequest('window_handle');
+ WebDriverRequest.getRequest('window_handle');
@override
String parseGetActiveWindowResponse(WebDriverResponse response) =>
@@ -37,7 +37,7 @@
@override
WebDriverRequest buildSetActiveRequest(String windowId) =>
- new WebDriverRequest.postRequest('window', {'name': windowId});
+ WebDriverRequest.postRequest('window', {'name': windowId});
@override
void parseSetActiveResponse(WebDriverResponse response) {
@@ -46,38 +46,37 @@
@override
WebDriverRequest buildLocationRequest() =>
- new WebDriverRequest.getRequest('window/current/position');
+ WebDriverRequest.getRequest('window/current/position');
@override
Point<int> parseLocationResponse(WebDriverResponse response) {
final point = parseJsonWireResponse(response);
- return new Point(point['x'].toInt(), point['y'].toInt());
+ return Point(point['x'].toInt(), point['y'].toInt());
}
@override
WebDriverRequest buildSizeRequest() =>
- new WebDriverRequest.getRequest('window/current/size');
+ WebDriverRequest.getRequest('window/current/size');
@override
Rectangle<int> parseSizeResponse(WebDriverResponse response) {
final size = parseJsonWireResponse(response);
- return new Rectangle<int>(
- 0, 0, size['width'].toInt(), size['height'].toInt());
+ return Rectangle<int>(0, 0, size['width'].toInt(), size['height'].toInt());
}
@override
WebDriverRequest buildRectRequest() {
- throw new UnsupportedError('Get Window Rect is not supported in JsonWire.');
+ throw UnsupportedError('Get Window Rect is not supported in JsonWire.');
}
@override
Rectangle<int> parseRectResponse(WebDriverResponse response) {
- throw new UnsupportedError('Get Window Rect is not supported in JsonWire.');
+ throw UnsupportedError('Get Window Rect is not supported in JsonWire.');
}
@override
WebDriverRequest buildSetLocationRequest(Point<int> location) =>
- new WebDriverRequest.postRequest('window/current/position',
+ WebDriverRequest.postRequest('window/current/position',
{'x': location.x.toInt(), 'y': location.y.toInt()});
@override
@@ -87,7 +86,7 @@
@override
WebDriverRequest buildSetSizeRequest(Rectangle<int> size) =>
- new WebDriverRequest.postRequest('window/current/size',
+ WebDriverRequest.postRequest('window/current/size',
{'width': size.width.toInt(), 'height': size.height.toInt()});
@override
@@ -97,17 +96,17 @@
@override
WebDriverRequest buildSetRectRequest(Rectangle<int> rect) {
- throw new UnsupportedError('Set Window Rect is not supported in JsonWire.');
+ throw UnsupportedError('Set Window Rect is not supported in JsonWire.');
}
@override
void parseSetRectResponse(WebDriverResponse response) {
- throw new UnsupportedError('Set Window Rect is not supported in JsonWire.');
+ throw UnsupportedError('Set Window Rect is not supported in JsonWire.');
}
@override
WebDriverRequest buildMaximizeRequest() =>
- new WebDriverRequest.postRequest('window/current/maximize');
+ WebDriverRequest.postRequest('window/current/maximize');
@override
void parseMaximizeResponse(WebDriverResponse response) {
@@ -123,7 +122,7 @@
@override
WebDriverRequest buildCloseRequest() =>
- new WebDriverRequest.deleteRequest('window');
+ WebDriverRequest.deleteRequest('window');
@override
void parseCloseResponse(WebDriverResponse response) {
@@ -132,7 +131,7 @@
@override
WebDriverRequest buildInnerSizeRequest() =>
- new WebDriverRequest.postRequest('execute', {
+ WebDriverRequest.postRequest('execute', {
'script':
'return { width: window.innerWidth, height: window.innerHeight };',
'args': []
diff --git a/lib/src/handler/json_wire_handler.dart b/lib/src/handler/json_wire_handler.dart
index 69d7462..3bad7bd 100644
--- a/lib/src/handler/json_wire_handler.dart
+++ b/lib/src/handler/json_wire_handler.dart
@@ -19,48 +19,48 @@
class JsonWireWebDriverHandler extends WebDriverHandler {
@override
- SessionHandler get session => new JsonWireSessionHandler();
+ SessionHandler get session => JsonWireSessionHandler();
@override
- final CoreHandler core = new JsonWireCoreHandler();
+ final CoreHandler core = JsonWireCoreHandler();
@override
- final KeyboardHandler keyboard = new JsonWireKeyboardHandler();
+ final KeyboardHandler keyboard = JsonWireKeyboardHandler();
@override
- final MouseHandler mouse = new JsonWireMouseHandler();
+ final MouseHandler mouse = JsonWireMouseHandler();
@override
- final ElementFinder elementFinder = new JsonWireElementFinder();
+ final ElementFinder elementFinder = JsonWireElementFinder();
@override
- final ElementHandler element = new JsonWireElementHandler();
+ final ElementHandler element = JsonWireElementHandler();
@override
- final AlertHandler alert = new JsonWireAlertHandler();
+ final AlertHandler alert = JsonWireAlertHandler();
@override
- final NavigationHandler navigation = new JsonWireNavigationHandler();
+ final NavigationHandler navigation = JsonWireNavigationHandler();
@override
- final WindowHandler window = new JsonWireWindowHandler();
+ final WindowHandler window = JsonWireWindowHandler();
@override
- final FrameHandler frame = new JsonWireFrameHandler();
+ final FrameHandler frame = JsonWireFrameHandler();
@override
- final CookiesHandler cookies = new JsonWireCookiesHandler();
+ final CookiesHandler cookies = JsonWireCookiesHandler();
@override
- final TimeoutsHandler timeouts = new JsonWireTimeoutsHandler();
+ final TimeoutsHandler timeouts = JsonWireTimeoutsHandler();
@override
- final LogsHandler logs = new JsonWireLogsHandler();
+ final LogsHandler logs = JsonWireLogsHandler();
@override
WebDriverRequest buildGeneralRequest(HttpMethod method, String uri,
[params]) =>
- new WebDriverRequest(
+ WebDriverRequest(
method, uri, params == null ? null : json.encode(serialize(params)));
@override
diff --git a/lib/src/handler/w3c/alert.dart b/lib/src/handler/w3c/alert.dart
index 864dbc6..74c2580 100644
--- a/lib/src/handler/w3c/alert.dart
+++ b/lib/src/handler/w3c/alert.dart
@@ -19,7 +19,7 @@
class W3cAlertHandler implements AlertHandler {
@override
WebDriverRequest buildGetTextRequest() =>
- new WebDriverRequest.getRequest('alert/text');
+ WebDriverRequest.getRequest('alert/text');
@override
String parseGetTextResponse(WebDriverResponse response) =>
@@ -27,7 +27,7 @@
@override
WebDriverRequest buildAcceptRequest() =>
- new WebDriverRequest.postRequest('alert/accept');
+ WebDriverRequest.postRequest('alert/accept');
@override
void parseAcceptResponse(WebDriverResponse response) {
@@ -36,7 +36,7 @@
@override
WebDriverRequest buildDismissRequest() =>
- new WebDriverRequest.postRequest('alert/dismiss');
+ WebDriverRequest.postRequest('alert/dismiss');
@override
void parseDismissResponse(WebDriverResponse response) {
@@ -47,7 +47,7 @@
// But this is what geckodriver uses.
@override
WebDriverRequest buildSendTextRequest(String keysToSend) =>
- new WebDriverRequest.postRequest('alert/text', {'text': keysToSend});
+ WebDriverRequest.postRequest('alert/text', {'text': keysToSend});
@override
void parseSendTextResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/w3c/cookies.dart b/lib/src/handler/w3c/cookies.dart
index 457a6e4..c4d1185 100644
--- a/lib/src/handler/w3c/cookies.dart
+++ b/lib/src/handler/w3c/cookies.dart
@@ -20,8 +20,7 @@
class W3cCookiesHandler extends CookiesHandler {
@override
WebDriverRequest buildAddCookieRequest(Cookie cookie) =>
- new WebDriverRequest.postRequest(
- 'cookie', {'cookie': _serialize(cookie)});
+ WebDriverRequest.postRequest('cookie', {'cookie': _serialize(cookie)});
@override
void parseAddCookieResponse(WebDriverResponse response) {
@@ -30,7 +29,7 @@
@override
WebDriverRequest buildDeleteCookieRequest(String name) =>
- new WebDriverRequest.deleteRequest('cookie/$name');
+ WebDriverRequest.deleteRequest('cookie/$name');
@override
void parseDeleteCookieResponse(WebDriverResponse response) {
@@ -39,7 +38,7 @@
@override
WebDriverRequest buildDeleteAllCookiesRequest() =>
- new WebDriverRequest.deleteRequest('cookie');
+ WebDriverRequest.deleteRequest('cookie');
@override
void parseDeleteAllCookiesResponse(WebDriverResponse response) {
@@ -48,7 +47,7 @@
@override
WebDriverRequest buildGetCookieRequest(String name) =>
- new WebDriverRequest.getRequest('cookie/$name');
+ WebDriverRequest.getRequest('cookie/$name');
@override
Cookie parseGetCookieResponse(WebDriverResponse response, String name) =>
@@ -56,7 +55,7 @@
@override
WebDriverRequest buildGetAllCookiesRequest() =>
- new WebDriverRequest.getRequest('cookie');
+ WebDriverRequest.getRequest('cookie');
@override
List<Cookie> parseGetAllCookiesResponse(WebDriverResponse response) =>
@@ -70,5 +69,5 @@
/// Deserializes the json object to get the cookie according to the spec.
///
/// The spec is deserializing the same we do in [Cookie.fromJson].
- Cookie _deserialize(dynamic content) => new Cookie.fromJson(content);
+ Cookie _deserialize(dynamic content) => Cookie.fromJson(content);
}
diff --git a/lib/src/handler/w3c/core.dart b/lib/src/handler/w3c/core.dart
index 87bb3ef..94ed27e 100644
--- a/lib/src/handler/w3c/core.dart
+++ b/lib/src/handler/w3c/core.dart
@@ -5,15 +5,14 @@
class W3cCoreHandler extends CoreHandler {
@override
WebDriverRequest buildCurrentUrlRequest() =>
- new WebDriverRequest.getRequest('url');
+ WebDriverRequest.getRequest('url');
@override
String parseCurrentUrlResponse(WebDriverResponse response) =>
parseW3cResponse(response);
@override
- WebDriverRequest buildTitleRequest() =>
- new WebDriverRequest.getRequest('title');
+ WebDriverRequest buildTitleRequest() => WebDriverRequest.getRequest('title');
@override
String parseTitleResponse(WebDriverResponse response) =>
@@ -21,7 +20,7 @@
@override
WebDriverRequest buildPageSourceRequest() =>
- new WebDriverRequest.getRequest('source');
+ WebDriverRequest.getRequest('source');
@override
String parsePageSourceResponse(WebDriverResponse response) =>
@@ -29,7 +28,7 @@
@override
WebDriverRequest buildScreenshotRequest() =>
- new WebDriverRequest.getRequest('screenshot');
+ WebDriverRequest.getRequest('screenshot');
@override
String parseScreenshotResponse(WebDriverResponse response) =>
@@ -37,7 +36,7 @@
@override
WebDriverRequest buildExecuteAsyncRequest(String script, List args) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'execute/async', {'script': script, 'args': serialize(args)});
@override
@@ -47,7 +46,7 @@
@override
WebDriverRequest buildExecuteRequest(String script, List args) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'execute/sync', {'script': script, 'args': serialize(args)});
@override
@@ -57,7 +56,7 @@
@override
WebDriverRequest buildDeleteSessionRequest() =>
- new WebDriverRequest.deleteRequest('');
+ WebDriverRequest.deleteRequest('');
@override
void parseDeleteSessionResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/w3c/element.dart b/lib/src/handler/w3c/element.dart
index 7afafb0..ff0212b 100644
--- a/lib/src/handler/w3c/element.dart
+++ b/lib/src/handler/w3c/element.dart
@@ -8,7 +8,7 @@
class W3cElementHandler extends ElementHandler {
@override
WebDriverRequest buildClickRequest(String elementId) {
- return new WebDriverRequest.postRequest('${elementPrefix(elementId)}click');
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}click');
}
@override
@@ -18,8 +18,7 @@
@override
WebDriverRequest buildSendKeysRequest(String elementId, String keysToSend) {
- return new WebDriverRequest.postRequest(
- '${elementPrefix(elementId)}value', {
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}value', {
'text': keysToSend, // What geckodriver really wants.
'value': keysToSend // Actual W3C spec.
});
@@ -32,7 +31,7 @@
@override
WebDriverRequest buildClearRequest(String elementId) {
- return new WebDriverRequest.postRequest('${elementPrefix(elementId)}clear');
+ return WebDriverRequest.postRequest('${elementPrefix(elementId)}clear');
}
@override
@@ -88,16 +87,16 @@
@override
Rectangle<int> parseSizeResponse(WebDriverResponse response) {
final rect = _parseRectResponse(response);
- return new Rectangle(0, 0, rect.width, rect.height);
+ return Rectangle(0, 0, rect.width, rect.height);
}
WebDriverRequest _buildRectRequest(String elementId) {
- return new WebDriverRequest.getRequest('${elementPrefix(elementId)}rect');
+ return WebDriverRequest.getRequest('${elementPrefix(elementId)}rect');
}
Rectangle<int> _parseRectResponse(WebDriverResponse response) {
final rect = parseW3cResponse(response);
- return new Rectangle(rect['x'].toInt(), rect['y'].toInt(),
+ return Rectangle(rect['x'].toInt(), rect['y'].toInt(),
rect['width'].toInt(), rect['height'].toInt());
}
diff --git a/lib/src/handler/w3c/element_finder.dart b/lib/src/handler/w3c/element_finder.dart
index 8192d59..e30c9ad 100644
--- a/lib/src/handler/w3c/element_finder.dart
+++ b/lib/src/handler/w3c/element_finder.dart
@@ -37,7 +37,7 @@
@override
WebDriverRequest buildFindElementsRequest(By by, [String contextElementId]) {
String uri = '${elementPrefix(contextElementId)}elements';
- return new WebDriverRequest.postRequest(uri, _byToJson(by));
+ return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@override
@@ -51,7 +51,7 @@
@override
WebDriverRequest buildFindElementRequest(By by, [String contextElementId]) {
String uri = '${elementPrefix(contextElementId)}element';
- return new WebDriverRequest.postRequest(uri, _byToJson(by));
+ return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@override
@@ -61,7 +61,7 @@
@override
WebDriverRequest buildFindActiveElementRequest() {
- return new WebDriverRequest.getRequest('element/active');
+ return WebDriverRequest.getRequest('element/active');
}
@override
diff --git a/lib/src/handler/w3c/frame.dart b/lib/src/handler/w3c/frame.dart
index 9e1ebc6..b3847aa 100644
--- a/lib/src/handler/w3c/frame.dart
+++ b/lib/src/handler/w3c/frame.dart
@@ -19,7 +19,7 @@
class W3cFrameHandler extends FrameHandler {
@override
WebDriverRequest buildSwitchByIdRequest([int id]) =>
- new WebDriverRequest.postRequest('frame', {'id': id});
+ WebDriverRequest.postRequest('frame', {'id': id});
@override
void parseSwitchByIdResponse(WebDriverResponse response) {
@@ -28,7 +28,7 @@
@override
WebDriverRequest buildSwitchByElementRequest(String elementId) =>
- new WebDriverRequest.postRequest('frame', {
+ WebDriverRequest.postRequest('frame', {
'id': {w3cElementStr: elementId}
});
@@ -39,7 +39,7 @@
@override
WebDriverRequest buildSwitchToParentRequest() =>
- new WebDriverRequest.postRequest('frame/parent');
+ WebDriverRequest.postRequest('frame/parent');
@override
void parseSwitchToParentResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/w3c/keyboard.dart b/lib/src/handler/w3c/keyboard.dart
index 4d70427..e957e18 100644
--- a/lib/src/handler/w3c/keyboard.dart
+++ b/lib/src/handler/w3c/keyboard.dart
@@ -12,7 +12,7 @@
keyUpActions.add({'type': 'keyUp', 'value': s});
}
- return new WebDriverRequest.postRequest('actions', {
+ return WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'key',
@@ -36,7 +36,7 @@
keyActions.add({'type': 'keyDown', 'value': keysToSend[i]});
keyActions.add({'type': 'keyUp', 'value': keysToSend[i]});
}
- return new WebDriverRequest.postRequest('actions', {
+ return WebDriverRequest.postRequest('actions', {
'actions': [
{'type': 'key', 'id': 'keys', 'actions': keyActions}
]
diff --git a/lib/src/handler/w3c/mouse.dart b/lib/src/handler/w3c/mouse.dart
index a07366e..a90cb83 100644
--- a/lib/src/handler/w3c/mouse.dart
+++ b/lib/src/handler/w3c/mouse.dart
@@ -7,7 +7,7 @@
@override
WebDriverRequest buildClickRequest(
[MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('actions', {
+ WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'pointer',
@@ -28,7 +28,7 @@
@override
WebDriverRequest buildDownRequest(
[MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('actions', {
+ WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'pointer',
@@ -47,7 +47,7 @@
@override
WebDriverRequest buildUpRequest([MouseButton button = MouseButton.primary]) =>
- new WebDriverRequest.postRequest('actions', {
+ WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'pointer',
@@ -66,7 +66,7 @@
@override
WebDriverRequest buildDoubleClickRequest() =>
- new WebDriverRequest.postRequest('actions', {
+ WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'pointer',
@@ -88,8 +88,11 @@
@override
WebDriverRequest buildMoveToRequest(
- {String elementId, int xOffset, int yOffset, bool absolute: false}) =>
- new WebDriverRequest.postRequest('actions', {
+ {String elementId,
+ int xOffset,
+ int yOffset,
+ bool absolute = false}) =>
+ WebDriverRequest.postRequest('actions', {
'actions': [
{
'type': 'pointer',
diff --git a/lib/src/handler/w3c/navigation.dart b/lib/src/handler/w3c/navigation.dart
index 0bff82f..12c3b1b 100644
--- a/lib/src/handler/w3c/navigation.dart
+++ b/lib/src/handler/w3c/navigation.dart
@@ -19,7 +19,7 @@
class W3cNavigationHandler extends NavigationHandler {
@override
WebDriverRequest buildNavigateToRequest(String url) =>
- new WebDriverRequest.postRequest('url', {'url': url});
+ WebDriverRequest.postRequest('url', {'url': url});
@override
void parseNavigateToResponse(WebDriverResponse response) {
@@ -28,7 +28,7 @@
@override
WebDriverRequest buildForwardRequest() =>
- new WebDriverRequest.postRequest('forward');
+ WebDriverRequest.postRequest('forward');
@override
void parseForwardResponse(WebDriverResponse response) {
@@ -36,8 +36,7 @@
}
@override
- WebDriverRequest buildBackRequest() =>
- new WebDriverRequest.postRequest('back');
+ WebDriverRequest buildBackRequest() => WebDriverRequest.postRequest('back');
@override
void parseBackResponse(WebDriverResponse response) {
@@ -46,7 +45,7 @@
@override
WebDriverRequest buildRefreshRequest() =>
- new WebDriverRequest.postRequest('refresh');
+ WebDriverRequest.postRequest('refresh');
@override
void parseRefreshResponse(WebDriverResponse response) {
diff --git a/lib/src/handler/w3c/session.dart b/lib/src/handler/w3c/session.dart
index 7051b46..d72c567 100644
--- a/lib/src/handler/w3c/session.dart
+++ b/lib/src/handler/w3c/session.dart
@@ -9,7 +9,7 @@
@override
WebDriverRequest buildCreateRequest({Map<String, dynamic> desired}) {
desired ??= Capabilities.empty;
- return new WebDriverRequest.postRequest('session', {
+ return WebDriverRequest.postRequest('session', {
'capabilities': {'alwaysMatch': desired}
});
}
@@ -17,16 +17,16 @@
@override
SessionInfo parseCreateResponse(WebDriverResponse response) {
final session = parseW3cResponse(response);
- return new SessionInfo(
+ return SessionInfo(
session['sessionId'], WebDriverSpec.W3c, session['capabilities']);
}
/// Requesting existing session info is not supported in W3c.
@override
WebDriverRequest buildInfoRequest(String id) =>
- new WebDriverRequest.nullRequest(id);
+ WebDriverRequest.nullRequest(id);
@override
SessionInfo parseInfoResponse(WebDriverResponse response) =>
- new SessionInfo(response.body, WebDriverSpec.W3c, Capabilities.empty);
+ SessionInfo(response.body, WebDriverSpec.W3c, Capabilities.empty);
}
diff --git a/lib/src/handler/w3c/timeouts.dart b/lib/src/handler/w3c/timeouts.dart
index 2bdfb00..7efff02 100644
--- a/lib/src/handler/w3c/timeouts.dart
+++ b/lib/src/handler/w3c/timeouts.dart
@@ -18,8 +18,7 @@
class W3cTimeoutsHandler extends TimeoutsHandler {
WebDriverRequest _buildSetTimeoutRequest(String type, Duration timeout) =>
- new WebDriverRequest.postRequest(
- 'timeouts', {type: timeout.inMilliseconds});
+ WebDriverRequest.postRequest('timeouts', {type: timeout.inMilliseconds});
@override
WebDriverRequest buildSetScriptTimeoutRequest(Duration timeout) =>
diff --git a/lib/src/handler/w3c/utils.dart b/lib/src/handler/w3c/utils.dart
index 93e46a8..2bd0845 100644
--- a/lib/src/handler/w3c/utils.dart
+++ b/lib/src/handler/w3c/utils.dart
@@ -16,7 +16,7 @@
final rawBody = response.body == null || response.body.isEmpty
? '<empty response>'
: response.body;
- throw new WebDriverException(
+ throw WebDriverException(
response.statusCode, 'Error parsing response body: $rawBody');
}
@@ -25,100 +25,94 @@
// See https://www.w3.org/TR/webdriver/#handling-errors
switch (value['error']) {
case 'element click intercepted':
- throw new ElementClickInterceptedException(
+ throw ElementClickInterceptedException(
response.statusCode, value['message']);
case 'element not interactable':
- throw new ElementNotInteractableException(
+ throw ElementNotInteractableException(
response.statusCode, value['message']);
case 'insecure certificate':
- throw new InsecureCertificateException(
+ throw InsecureCertificateException(
response.statusCode, value['message']);
case 'invalid argument':
- throw new InvalidArgumentException(
- response.statusCode, value['message']);
+ throw InvalidArgumentException(response.statusCode, value['message']);
case 'invalid cookie domain':
- throw new InvalidCookieDomainException(
+ throw InvalidCookieDomainException(
response.statusCode, value['message']);
case 'invalid element state':
- throw new InvalidElementStateException(
+ throw InvalidElementStateException(
response.statusCode, value['message']);
case 'invalid selector':
- throw new InvalidSelectorException(
- response.statusCode, value['message']);
+ throw InvalidSelectorException(response.statusCode, value['message']);
case 'invalid session id':
- throw new InvalidSessionIdException(
- response.statusCode, value['message']);
+ throw InvalidSessionIdException(response.statusCode, value['message']);
case 'javascript error':
- throw new JavaScriptException(response.statusCode, value['message']);
+ throw JavaScriptException(response.statusCode, value['message']);
case 'move target out of bounds':
- throw new MoveTargetOutOfBoundsException(
+ throw MoveTargetOutOfBoundsException(
response.statusCode, value['message']);
case 'no such alert':
- throw new NoSuchAlertException(response.statusCode, value['message']);
+ throw NoSuchAlertException(response.statusCode, value['message']);
case 'no such cookie':
- throw new NoSuchCookieException(response.statusCode, value['message']);
+ throw NoSuchCookieException(response.statusCode, value['message']);
case 'no such element':
- throw new NoSuchElementException(response.statusCode, value['message']);
+ throw NoSuchElementException(response.statusCode, value['message']);
case 'no such frame':
- throw new NoSuchFrameException(response.statusCode, value['message']);
+ throw NoSuchFrameException(response.statusCode, value['message']);
case 'no such window':
- throw new NoSuchWindowException(response.statusCode, value['message']);
+ throw NoSuchWindowException(response.statusCode, value['message']);
case 'script timeout':
- throw new ScriptTimeoutException(response.statusCode, value['message']);
+ throw ScriptTimeoutException(response.statusCode, value['message']);
case 'session not created':
- throw new SessionNotCreatedException(
- response.statusCode, value['message']);
+ throw SessionNotCreatedException(response.statusCode, value['message']);
case 'stale element reference':
- throw new StaleElementReferenceException(
+ throw StaleElementReferenceException(
response.statusCode, value['message']);
case 'timeout':
- throw new TimeoutException(response.statusCode, value['message']);
+ throw TimeoutException(response.statusCode, value['message']);
case 'unable to set cookie':
- throw new UnableToSetCookieException(
- response.statusCode, value['message']);
+ throw UnableToSetCookieException(response.statusCode, value['message']);
case 'unable to capture screen':
- throw new UnableToCaptureScreenException(
+ throw UnableToCaptureScreenException(
response.statusCode, value['message']);
case 'unexpected alert open':
- throw new UnexpectedAlertOpenException(
+ throw UnexpectedAlertOpenException(
response.statusCode, value['message']);
case 'unknown command':
- throw new UnknownCommandException(
- response.statusCode, value['message']);
+ throw UnknownCommandException(response.statusCode, value['message']);
case 'unknown error':
- throw new UnknownException(response.statusCode, value['message']);
+ throw UnknownException(response.statusCode, value['message']);
case 'unknown method':
- throw new UnknownMethodException(response.statusCode, value['message']);
+ throw UnknownMethodException(response.statusCode, value['message']);
case 'unsupported operation':
- throw new UnsupportedOperationException(
+ throw UnsupportedOperationException(
response.statusCode, value['message']);
default:
- throw new WebDriverException(response.statusCode, value['message']);
+ throw WebDriverException(response.statusCode, value['message']);
}
}
diff --git a/lib/src/handler/w3c/window.dart b/lib/src/handler/w3c/window.dart
index d096e11..9b1829a 100644
--- a/lib/src/handler/w3c/window.dart
+++ b/lib/src/handler/w3c/window.dart
@@ -21,7 +21,7 @@
class W3cWindowHandler extends WindowHandler {
@override
WebDriverRequest buildGetWindowsRequest() =>
- new WebDriverRequest.getRequest('window/handles');
+ WebDriverRequest.getRequest('window/handles');
@override
List<String> parseGetWindowsResponse(WebDriverResponse response) =>
@@ -29,7 +29,7 @@
@override
WebDriverRequest buildGetActiveWindowRequest() =>
- new WebDriverRequest.getRequest('window');
+ WebDriverRequest.getRequest('window');
@override
String parseGetActiveWindowResponse(WebDriverResponse response) =>
@@ -37,7 +37,7 @@
@override
WebDriverRequest buildSetActiveRequest(String windowId) =>
- new WebDriverRequest.postRequest('window', {'handle': windowId});
+ WebDriverRequest.postRequest('window', {'handle': windowId});
@override
void parseSetActiveResponse(WebDriverResponse response) {
@@ -57,23 +57,23 @@
@override
Rectangle<int> parseSizeResponse(WebDriverResponse response) {
final rect = parseRectResponse(response);
- return new Rectangle(0, 0, rect.width, rect.height);
+ return Rectangle(0, 0, rect.width, rect.height);
}
@override
WebDriverRequest buildRectRequest() =>
- new WebDriverRequest.getRequest('window/rect');
+ WebDriverRequest.getRequest('window/rect');
@override
Rectangle<int> parseRectResponse(WebDriverResponse response) {
final rect = parseW3cResponse(response);
- return new Rectangle(rect['x'].toInt(), rect['y'].toInt(),
+ return Rectangle(rect['x'].toInt(), rect['y'].toInt(),
rect['width'].toInt(), rect['height'].toInt());
}
@override
WebDriverRequest buildSetLocationRequest(Point<int> location) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'window/rect', {'x': location.x, 'y': location.y});
@override
@@ -83,7 +83,7 @@
@override
WebDriverRequest buildSetSizeRequest(Rectangle<int> size) =>
- new WebDriverRequest.postRequest(
+ WebDriverRequest.postRequest(
'window/rect', {'width': size.width, 'height': size.height});
@override
@@ -93,7 +93,7 @@
@override
WebDriverRequest buildSetRectRequest(Rectangle<int> rect) =>
- new WebDriverRequest.postRequest('window/rect', {
+ WebDriverRequest.postRequest('window/rect', {
'x': rect.left,
'y': rect.top,
'width': rect.width,
@@ -107,7 +107,7 @@
@override
WebDriverRequest buildMaximizeRequest() =>
- new WebDriverRequest.postRequest('window/maximize');
+ WebDriverRequest.postRequest('window/maximize');
@override
void parseMaximizeResponse(WebDriverResponse response) {
@@ -116,7 +116,7 @@
@override
WebDriverRequest buildMinimizeRequest() =>
- new WebDriverRequest.postRequest('window/minimize');
+ WebDriverRequest.postRequest('window/minimize');
@override
void parseMinimizeResponse(WebDriverResponse response) {
@@ -125,7 +125,7 @@
@override
WebDriverRequest buildCloseRequest() =>
- new WebDriverRequest.deleteRequest('window');
+ WebDriverRequest.deleteRequest('window');
@override
void parseCloseResponse(WebDriverResponse response) {
@@ -134,7 +134,7 @@
@override
WebDriverRequest buildInnerSizeRequest() =>
- new WebDriverRequest.postRequest('execute/sync', {
+ WebDriverRequest.postRequest('execute/sync', {
'script':
'return { width: window.innerWidth, height: window.innerHeight };',
'args': []
diff --git a/lib/src/handler/w3c_handler.dart b/lib/src/handler/w3c_handler.dart
index 940b517..222cc7d 100644
--- a/lib/src/handler/w3c_handler.dart
+++ b/lib/src/handler/w3c_handler.dart
@@ -18,49 +18,49 @@
class W3cWebDriverHandler extends WebDriverHandler {
@override
- final SessionHandler session = new W3cSessionHandler();
+ final SessionHandler session = W3cSessionHandler();
@override
- final CoreHandler core = new W3cCoreHandler();
+ final CoreHandler core = W3cCoreHandler();
@override
- final KeyboardHandler keyboard = new W3cKeyboardHandler();
+ final KeyboardHandler keyboard = W3cKeyboardHandler();
@override
- final MouseHandler mouse = new W3cMouseHandler();
+ final MouseHandler mouse = W3cMouseHandler();
@override
- final ElementFinder elementFinder = new W3cElementFinder();
+ final ElementFinder elementFinder = W3cElementFinder();
@override
- final ElementHandler element = new W3cElementHandler();
+ final ElementHandler element = W3cElementHandler();
@override
- final AlertHandler alert = new W3cAlertHandler();
+ final AlertHandler alert = W3cAlertHandler();
@override
- final NavigationHandler navigation = new W3cNavigationHandler();
+ final NavigationHandler navigation = W3cNavigationHandler();
@override
- final WindowHandler window = new W3cWindowHandler();
+ final WindowHandler window = W3cWindowHandler();
@override
- final FrameHandler frame = new W3cFrameHandler();
+ final FrameHandler frame = W3cFrameHandler();
@override
- final CookiesHandler cookies = new W3cCookiesHandler();
+ final CookiesHandler cookies = W3cCookiesHandler();
@override
- TimeoutsHandler timeouts = new W3cTimeoutsHandler();
+ TimeoutsHandler timeouts = W3cTimeoutsHandler();
@override
LogsHandler get logs =>
- throw new UnsupportedError('Unsupported for W3cWebDriverHandler');
+ throw UnsupportedError('Unsupported for W3cWebDriverHandler');
@override
WebDriverRequest buildGeneralRequest(HttpMethod method, String uri,
[params]) =>
- new WebDriverRequest(
+ WebDriverRequest(
method, uri, params == null ? null : json.encode(serialize(params)));
@override
diff --git a/lib/src/request/async_io_request_client.dart b/lib/src/request/async_io_request_client.dart
index 8e838a0..2b13e27 100644
--- a/lib/src/request/async_io_request_client.dart
+++ b/lib/src/request/async_io_request_client.dart
@@ -9,9 +9,9 @@
/// Async request client using dart:io package.
class AsyncIoRequestClient extends AsyncRequestClient {
- final HttpClient client = new HttpClient();
+ final HttpClient client = HttpClient();
- final Lock _lock = new Lock();
+ final Lock _lock = Lock();
AsyncIoRequestClient(Uri prefix) : super(prefix);
@@ -39,7 +39,7 @@
if (request.body != null && request.body.isNotEmpty) {
httpRequest.headers.contentType =
- new ContentType('application', 'json', charset: 'utf-8');
+ ContentType('application', 'json', charset: 'utf-8');
final body = utf8.encode(request.body);
httpRequest.contentLength = body.length;
httpRequest.add(body);
@@ -48,7 +48,7 @@
try {
final response = await httpRequest.close();
- return new WebDriverResponse(response.statusCode, response.reasonPhrase,
+ return WebDriverResponse(response.statusCode, response.reasonPhrase,
await utf8.decodeStream(response));
} finally {
_lock.release();
diff --git a/lib/src/request/async_xhr_request_client.dart b/lib/src/request/async_xhr_request_client.dart
index f64650f..9781a2a 100644
--- a/lib/src/request/async_xhr_request_client.dart
+++ b/lib/src/request/async_xhr_request_client.dart
@@ -10,7 +10,7 @@
///
/// On the low level, it's using XMLHttpRequest object (XHR).
class AsyncXhrRequestClient extends AsyncRequestClient {
- final Lock _lock = new Lock();
+ final Lock _lock = Lock();
AsyncXhrRequestClient(Uri prefix) : super(prefix);
@@ -36,7 +36,7 @@
_lock.release();
}
- return new WebDriverResponse(
+ return WebDriverResponse(
httpRequest.status, httpRequest.statusText, httpRequest.response);
}
diff --git a/lib/src/request/sync_http_request_client.dart b/lib/src/request/sync_http_request_client.dart
index 9e05431..52d7dba 100644
--- a/lib/src/request/sync_http_request_client.dart
+++ b/lib/src/request/sync_http_request_client.dart
@@ -19,7 +19,7 @@
case HttpMethod.httpPost:
httpRequest = SyncHttpClient.postUrl(resolve(request.uri));
httpRequest.headers.contentType =
- new ContentType('application', 'json', charset: 'utf-8');
+ ContentType('application', 'json', charset: 'utf-8');
httpRequest.write(request.body);
break;
case HttpMethod.httpDelete:
@@ -32,7 +32,7 @@
final httpResponse = httpRequest.close();
- return new WebDriverResponse(
+ return WebDriverResponse(
httpResponse.statusCode, httpResponse.reasonPhrase, httpResponse.body);
}
diff --git a/lib/src/sync/common.dart b/lib/src/sync/common.dart
index 1164159..5f80834 100644
--- a/lib/src/sync/common.dart
+++ b/lib/src/sync/common.dart
@@ -25,7 +25,7 @@
// Source: https://www.w3.org/TR/webdriver/#elements
const String w3cElementStr = 'element-6066-11e4-a52e-4f735466cecf';
-typedef String GetAttribute(String name);
+typedef GetAttribute = String Function(String name);
/// Simple class to provide access to indexed properties such as WebElement
/// attributes or css styles.
diff --git a/lib/src/sync/common_io.dart b/lib/src/sync/common_io.dart
index 2584bc3..0467982 100644
--- a/lib/src/sync/common_io.dart
+++ b/lib/src/sync/common_io.dart
@@ -6,11 +6,11 @@
/// Returns an [async_core.WebDriver] with the same URI + session ID.
async_core.WebDriver createAsyncWebDriver(WebDriver driver) =>
- new async_core.WebDriver(
+ async_core.WebDriver(
driver.uri,
driver.id,
driver.capabilities,
- new AsyncIoRequestClient(driver.uri.resolve('session/${driver.id}/')),
+ AsyncIoRequestClient(driver.uri.resolve('session/${driver.id}/')),
driver.spec);
/// Returns an [async_core.WebElement] based on a current [WebElement].
diff --git a/lib/src/sync/mouse.dart b/lib/src/sync/mouse.dart
index 5d4f62f..51a2582 100644
--- a/lib/src/sync/mouse.dart
+++ b/lib/src/sync/mouse.dart
@@ -69,7 +69,7 @@
/// Special notes for W3C, if the destination is out of the current viewport,
/// an 'MoveTargetOutOfBounds' exception will be thrown.
void moveTo(
- {WebElement element, int xOffset, int yOffset, bool absolute: false}) {
+ {WebElement element, int xOffset, int yOffset, bool absolute = false}) {
_client.send(
_handler.mouse.buildMoveToRequest(
elementId: element?.id,
diff --git a/lib/src/sync/target_locator.dart b/lib/src/sync/target_locator.dart
index 08009fc..9926f1b 100644
--- a/lib/src/sync/target_locator.dart
+++ b/lib/src/sync/target_locator.dart
@@ -46,7 +46,7 @@
_client.send(_handler.frame.buildSwitchByElementRequest(frame.id),
_handler.frame.parseSwitchByElementResponse);
} else if (frame is String) {
- final frameId = _driver.findElement(new By.id(frame)).id;
+ final frameId = _driver.findElement(By.id(frame)).id;
_client.send(_handler.frame.buildSwitchByElementRequest(frameId),
_handler.frame.parseSwitchByElementResponse);
} else {
@@ -73,7 +73,7 @@
///
/// In implementation, just getting alert won't trigger anything. Call
/// `alert.text` or other action to really switch to alert.
- Alert get alert => new Alert(_client, _handler);
+ Alert get alert => Alert(_client, _handler);
@override
String toString() => '$_driver.switchTo';
diff --git a/lib/src/sync/web_driver.dart b/lib/src/sync/web_driver.dart
index a91a7ab..dc6ec5d 100644
--- a/lib/src/sync/web_driver.dart
+++ b/lib/src/sync/web_driver.dart
@@ -110,7 +110,7 @@
final elements = <WebElement>[];
int i = 0;
for (final id in ids) {
- elements.add(new WebElement(this, _client, _handler, id, this, by, i++));
+ elements.add(WebElement(this, _client, _handler, id, this, by, i++));
}
return elements;
@@ -119,7 +119,7 @@
/// Search for an element within the entire current page.
/// Throws [NoSuchElementException] if a matching element is not found.
@override
- WebElement findElement(By by) => new WebElement(
+ WebElement findElement(By by) => WebElement(
this,
_client,
_handler,
@@ -133,7 +133,7 @@
_handler.core.parsePageSourceResponse);
/// Quits the browser.
- void quit({bool closeSession: true}) {
+ void quit({bool closeSession = true}) {
if (closeSession) {
_client.send(_handler.core.buildDeleteSessionRequest(),
_handler.core.parseDeleteSessionResponse);
@@ -154,13 +154,13 @@
_handler.window.buildGetWindowsRequest(),
(response) => _handler.window
.parseGetWindowsResponse(response)
- .map<Window>((w) => new Window(_client, _handler, w))
+ .map<Window>((w) => Window(_client, _handler, w))
.toList());
/// Handle for the active tab/window.
Window get window => _client.send(
_handler.window.buildGetActiveWindowRequest(),
- (response) => new Window(_client, _handler,
+ (response) => Window(_client, _handler,
_handler.window.parseGetActiveWindowResponse(response)));
/// The currently focused element, or the body element if no element has
@@ -170,7 +170,7 @@
_handler.elementFinder.buildFindActiveElementRequest(),
_handler.elementFinder.parseFindActiveElementResponse);
if (id != null) {
- return new WebElement(this, _client, _handler, id, this, 'activeElement');
+ return WebElement(this, _client, _handler, id, this, 'activeElement');
}
return null;
}
@@ -178,9 +178,9 @@
/// Changes focus to specified targets.
///
/// Available targets are window, frame, and the current alert.
- TargetLocator get switchTo => new TargetLocator(this, _client, _handler);
+ TargetLocator get switchTo => TargetLocator(this, _client, _handler);
- Cookies get cookies => new Cookies(_client, _handler);
+ Cookies get cookies => Cookies(_client, _handler);
/// [logs.get(logType)] will give list of logs captured in browser.
///
@@ -188,13 +188,13 @@
/// list of logs, as the spec for this in W3C is not agreed on and Firefox
/// refuses to support non-spec features. See
/// https://github.com/w3c/webdriver/issues/406.
- Logs get logs => new Logs(_client, _handler);
+ Logs get logs => Logs(_client, _handler);
- Timeouts get timeouts => new Timeouts(_client, _handler);
+ Timeouts get timeouts => Timeouts(_client, _handler);
- Keyboard get keyboard => new Keyboard(_client, _handler);
+ Keyboard get keyboard => Keyboard(_client, _handler);
- Mouse get mouse => new Mouse(_client, _handler);
+ Mouse get mouse => Mouse(_client, _handler);
/// Take a screenshot of the current page as PNG and return it as
/// base64-encoded string.
@@ -230,7 +230,7 @@
_handler.core.buildExecuteAsyncRequest(script, args),
(response) => _handler.core.parseExecuteAsyncResponse(
response,
- (elementId) => new WebElement(
+ (elementId) => WebElement(
this, _client, _handler, elementId, this, 'javascript')));
/// Inject a snippet of JavaScript into the page for execution in the context
@@ -249,7 +249,7 @@
_handler.core.buildExecuteRequest(script, args),
(response) => _handler.core.parseExecuteResponse(
response,
- (elementId) => new WebElement(
+ (elementId) => WebElement(
this, _client, _handler, elementId, this, 'javascript')));
/// Performs post request on command to the WebDriver server.
@@ -277,8 +277,7 @@
response, (elementId) => getElement(elementId, this)));
WebElement getElement(String elementId, [context, locator, index]) =>
- new WebElement(
- this, _client, _handler, elementId, context, locator, index);
+ WebElement(this, _client, _handler, elementId, context, locator, index);
@override
WebDriver get driver => this;
diff --git a/lib/src/sync/web_element.dart b/lib/src/sync/web_element.dart
index af6c4a0..4d53e41 100644
--- a/lib/src/sync/web_element.dart
+++ b/lib/src/sync/web_element.dart
@@ -105,7 +105,7 @@
Rectangle<int> get rect {
final location = this.location;
final size = this.size;
- return new Rectangle<int>(location.x, location.y, size.width, size.height);
+ return Rectangle<int>(location.x, location.y, size.width, size.height);
}
/// The tag name for this element.
@@ -120,7 +120,7 @@
///
/// Throws [NoSuchElementException] if matching element is not found.
@override
- WebElement findElement(By by) => new WebElement(
+ WebElement findElement(By by) => WebElement(
driver,
_client,
_handler,
@@ -139,25 +139,24 @@
final elements = <WebElement>[];
int i = 0;
for (final id in ids) {
- elements
- .add(new WebElement(driver, _client, _handler, id, this, by, i++));
+ elements.add(WebElement(driver, _client, _handler, id, this, by, i++));
}
return elements;
}
/// Access to the HTML attributes of this tag.
- Attributes get attributes => new Attributes((name) => _client.send(
+ Attributes get attributes => Attributes((name) => _client.send(
_handler.element.buildAttributeRequest(id, name),
_handler.element.parseAttributeResponse));
/// Access to the HTML properties of this tag.
- Attributes get properties => new Attributes((name) => _client.send(
+ Attributes get properties => Attributes((name) => _client.send(
_handler.element.buildPropertyRequest(id, name),
_handler.element.parsePropertyResponse));
/// Access to the cssProperties of this element.
- Attributes get cssProperties => new Attributes((name) => _client.send(
+ Attributes get cssProperties => Attributes((name) => _client.send(
_handler.element.buildCssPropertyRequest(id, name),
_handler.element.parseCssPropertyResponse));
@@ -174,7 +173,7 @@
@override
String toString() {
- final out = new StringBuffer()..write(context);
+ final out = StringBuffer()..write(context);
if (locator is By) {
if (index == null) {
out.write('.findElement(');
diff --git a/lib/src/sync/window.dart b/lib/src/sync/window.dart
index edf0438..3cdfba3 100644
--- a/lib/src/sync/window.dart
+++ b/lib/src/sync/window.dart
@@ -57,8 +57,7 @@
// Delegate to other methods.
final location = this.location;
final size = this.size;
- return new Rectangle<int>(
- location.x, location.y, size.width, size.height);
+ return Rectangle<int>(location.x, location.y, size.width, size.height);
}
}
@@ -98,7 +97,7 @@
// JsonWire cannot implement this API in one call.
// Delegate to other methods.
location = value.topLeft;
- size = new Rectangle(0, 0, value.width, value.height);
+ size = Rectangle(0, 0, value.width, value.height);
}
}
diff --git a/lib/support/async.dart b/lib/support/async.dart
index 2aa3126..6b7fd55 100644
--- a/lib/support/async.dart
+++ b/lib/support/async.dart
@@ -19,15 +19,15 @@
import 'package:matcher/matcher.dart' as m;
import 'package:stack_trace/stack_trace.dart' show Chain;
-const defaultInterval = const Duration(milliseconds: 500);
-const defaultTimeout = const Duration(seconds: 5);
+const defaultInterval = Duration(milliseconds: 500);
+const defaultTimeout = Duration(seconds: 5);
-const clock = const Clock();
+const clock = Clock();
Future<T> waitFor<T>(FutureOr<T> condition(),
{matcher,
- Duration timeout: defaultTimeout,
- Duration interval: defaultInterval}) =>
+ Duration timeout = defaultTimeout,
+ Duration interval = defaultInterval}) =>
clock.waitFor<T>(condition,
matcher: matcher, timeout: timeout, interval: interval);
@@ -36,10 +36,10 @@
/// Sleep for the specified time.
Future sleep([Duration interval = defaultInterval]) =>
- new Future.delayed(interval);
+ Future.delayed(interval);
/// The current time.
- DateTime get now => new DateTime.now();
+ DateTime get now => DateTime.now();
/// Waits until [condition] evaluates to a value that matches [matcher] or
/// until [timeout] time has passed. If [condition] returns a [Future], then
@@ -51,8 +51,8 @@
/// thrown.
Future<T> waitFor<T>(FutureOr<T> condition(),
{matcher,
- Duration timeout: defaultTimeout,
- Duration interval: defaultInterval}) async {
+ Duration timeout = defaultTimeout,
+ Duration interval = defaultInterval}) async {
if (matcher != null) {
matcher = m.wrapMatcher(matcher);
}
@@ -81,7 +81,7 @@
if (matcher.matches(value, matchState)) {
return;
}
- var desc = new m.StringDescription()
+ var desc = m.StringDescription()
..add('Expected: ')
..addDescriptionOf(matcher)
..add('\n')
@@ -89,12 +89,12 @@
..addDescriptionOf(value)
..add('\n');
- var mismatchDescription = new m.StringDescription();
+ var mismatchDescription = m.StringDescription();
matcher.describeMismatch(value, mismatchDescription, matchState, true);
if (mismatchDescription.length > 0) {
desc.add(' Which: $mismatchDescription\n');
}
- throw new Exception(desc.toString());
+ throw Exception(desc.toString());
}
class Lock {
@@ -103,31 +103,31 @@
final bool awaitChecking;
- Lock({this.awaitChecking: false});
+ Lock({this.awaitChecking = false});
Future acquire() {
if (awaitChecking) {
if (isHeld) {
- return new Future.error(new StateError(
+ return Future.error(StateError(
'Maybe you missed an await? Lock is already held by:\n$_stack'));
} else {
- _stack = new Chain.current().terse;
- _lock = new Completer();
- return new Future.value();
+ _stack = Chain.current().terse;
+ _lock = Completer();
+ return Future.value();
}
} else {
return () async {
while (isHeld) {
await _lock.future;
}
- _lock = new Completer();
+ _lock = Completer();
}();
}
}
void release() {
if (!isHeld) {
- throw new StateError('No lock to release');
+ throw StateError('No lock to release');
}
_lock.complete();
_lock = null;
diff --git a/lib/support/firefox_profile.dart b/lib/support/firefox_profile.dart
index 9332a21..cf2dede 100644
--- a/lib/support/firefox_profile.dart
+++ b/lib/support/firefox_profile.dart
@@ -23,77 +23,77 @@
/// Unmodifiable defaults for 'prefs.js' and 'user.js'.
final List<PrefsOption> lockedPrefs = <PrefsOption>[
- new BooleanOption('app.update.auto', false),
- new BooleanOption('app.update.enabled', false),
- new IntegerOption('browser.displayedE10SNotice', 4),
- new BooleanOption('browser.download.manager.showWhenStarting', false),
- new BooleanOption('browser.EULA.override', true),
- new BooleanOption('browser.EULA.3.accepted', true),
- new IntegerOption('browser.link.open_external', 2),
- new IntegerOption('browser.link.open_newwindow', 2),
- new BooleanOption('browser.offline', false),
- new BooleanOption('browser.reader.detectedFirstArticle', true),
- new BooleanOption('browser.safebrowsing.enabled', false),
- new BooleanOption('browser.safebrowsing.malware.enabled', false),
- new BooleanOption('browser.search.update', false),
- new StringOption('browser.selfsupport.url', ''),
- new BooleanOption('browser.sessionstore.resume_from_crash', false),
- new BooleanOption('browser.shell.checkDefaultBrowser', false),
- new BooleanOption('browser.tabs.warnOnClose', false),
- new BooleanOption('browser.tabs.warnOnOpen', false),
- new BooleanOption('datareporting.healthreport.service.enabled', false),
- new BooleanOption('datareporting.healthreport.uploadEnabled', false),
- new BooleanOption('datareporting.healthreport.service.firstRun', false),
- new BooleanOption('datareporting.healthreport.logging.consoleEnabled', false),
- new BooleanOption('datareporting.policy.dataSubmissionEnabled', false),
- new BooleanOption('datareporting.policy.dataSubmissionPolicyAccepted', false),
- new BooleanOption('devtools.errorconsole.enabled', true),
- new BooleanOption('dom.disable_open_during_load', false),
- new IntegerOption('extensions.autoDisableScopes', 10),
- new BooleanOption('extensions.blocklist.enabled', false),
- new BooleanOption('extensions.logging.enabled', true),
- new BooleanOption('extensions.update.enabled', false),
- new BooleanOption('extensions.update.notifyUser', false),
- new BooleanOption('javascript.enabled', true),
- new BooleanOption('network.manage-offline-status', false),
- new IntegerOption('network.http.phishy-userpass-length', 255),
- new BooleanOption('offline-apps.allow_by_default', true),
- new BooleanOption('prompts.tab_modal.enabled', false),
- new BooleanOption('security.csp.enable', false),
- new IntegerOption('security.fileuri.origin_policy', 3),
- new BooleanOption('security.fileuri.strict_origin_policy', false),
- new BooleanOption('security.warn_entering_secure', false),
- new BooleanOption('security.warn_entering_secure.show_once', false),
- new BooleanOption('security.warn_entering_weak', false),
- new BooleanOption('security.warn_entering_weak.show_once', false),
- new BooleanOption('security.warn_leaving_secure', false),
- new BooleanOption('security.warn_leaving_secure.show_once', false),
- new BooleanOption('security.warn_submit_insecure', false),
- new BooleanOption('security.warn_viewing_mixed', false),
- new BooleanOption('security.warn_viewing_mixed.show_once', false),
- new BooleanOption('signon.rememberSignons', false),
- new BooleanOption('toolkit.networkmanager.disable', true),
- new IntegerOption('toolkit.telemetry.prompted', 2),
- new BooleanOption('toolkit.telemetry.enabled', false),
- new BooleanOption('toolkit.telemetry.rejected', true),
- new BooleanOption('xpinstall.signatures.required', false),
+ BooleanOption('app.update.auto', false),
+ BooleanOption('app.update.enabled', false),
+ IntegerOption('browser.displayedE10SNotice', 4),
+ BooleanOption('browser.download.manager.showWhenStarting', false),
+ BooleanOption('browser.EULA.override', true),
+ BooleanOption('browser.EULA.3.accepted', true),
+ IntegerOption('browser.link.open_external', 2),
+ IntegerOption('browser.link.open_newwindow', 2),
+ BooleanOption('browser.offline', false),
+ BooleanOption('browser.reader.detectedFirstArticle', true),
+ BooleanOption('browser.safebrowsing.enabled', false),
+ BooleanOption('browser.safebrowsing.malware.enabled', false),
+ BooleanOption('browser.search.update', false),
+ StringOption('browser.selfsupport.url', ''),
+ BooleanOption('browser.sessionstore.resume_from_crash', false),
+ BooleanOption('browser.shell.checkDefaultBrowser', false),
+ BooleanOption('browser.tabs.warnOnClose', false),
+ BooleanOption('browser.tabs.warnOnOpen', false),
+ BooleanOption('datareporting.healthreport.service.enabled', false),
+ BooleanOption('datareporting.healthreport.uploadEnabled', false),
+ BooleanOption('datareporting.healthreport.service.firstRun', false),
+ BooleanOption('datareporting.healthreport.logging.consoleEnabled', false),
+ BooleanOption('datareporting.policy.dataSubmissionEnabled', false),
+ BooleanOption('datareporting.policy.dataSubmissionPolicyAccepted', false),
+ BooleanOption('devtools.errorconsole.enabled', true),
+ BooleanOption('dom.disable_open_during_load', false),
+ IntegerOption('extensions.autoDisableScopes', 10),
+ BooleanOption('extensions.blocklist.enabled', false),
+ BooleanOption('extensions.logging.enabled', true),
+ BooleanOption('extensions.update.enabled', false),
+ BooleanOption('extensions.update.notifyUser', false),
+ BooleanOption('javascript.enabled', true),
+ BooleanOption('network.manage-offline-status', false),
+ IntegerOption('network.http.phishy-userpass-length', 255),
+ BooleanOption('offline-apps.allow_by_default', true),
+ BooleanOption('prompts.tab_modal.enabled', false),
+ BooleanOption('security.csp.enable', false),
+ IntegerOption('security.fileuri.origin_policy', 3),
+ BooleanOption('security.fileuri.strict_origin_policy', false),
+ BooleanOption('security.warn_entering_secure', false),
+ BooleanOption('security.warn_entering_secure.show_once', false),
+ BooleanOption('security.warn_entering_weak', false),
+ BooleanOption('security.warn_entering_weak.show_once', false),
+ BooleanOption('security.warn_leaving_secure', false),
+ BooleanOption('security.warn_leaving_secure.show_once', false),
+ BooleanOption('security.warn_submit_insecure', false),
+ BooleanOption('security.warn_viewing_mixed', false),
+ BooleanOption('security.warn_viewing_mixed.show_once', false),
+ BooleanOption('signon.rememberSignons', false),
+ BooleanOption('toolkit.networkmanager.disable', true),
+ IntegerOption('toolkit.telemetry.prompted', 2),
+ BooleanOption('toolkit.telemetry.enabled', false),
+ BooleanOption('toolkit.telemetry.rejected', true),
+ BooleanOption('xpinstall.signatures.required', false),
];
/// Default values for 'user.js'.
final List<PrefsOption> defaultUserPrefs = <PrefsOption>[
- new BooleanOption('browser.dom.window.dump.enabled', true),
- new StringOption('browser.newtab.url', 'about:blank'),
- new BooleanOption('browser.newtabpage.enabled', false),
- new IntegerOption('browser.startup.page', 0),
- new StringOption('browser.startup.homepage', 'about:blank'),
- new IntegerOption('dom.max_chrome_script_run_time', 30),
- new IntegerOption('dom.max_script_run_time', 30),
- new BooleanOption('dom.report_all_js_exceptions', true),
- new BooleanOption('javascript.options.showInConsole', true),
- new IntegerOption('network.http.max-connections-per-server', 10),
- new StringOption('startup.homepage_welcome_url', 'about:blank'),
- new BooleanOption('webdriver_accept_untrusted_certs', true),
- new BooleanOption('webdriver_assume_untrusted_issuer', true),
+ BooleanOption('browser.dom.window.dump.enabled', true),
+ StringOption('browser.newtab.url', 'about:blank'),
+ BooleanOption('browser.newtabpage.enabled', false),
+ IntegerOption('browser.startup.page', 0),
+ StringOption('browser.startup.homepage', 'about:blank'),
+ IntegerOption('dom.max_chrome_script_run_time', 30),
+ IntegerOption('dom.max_script_run_time', 30),
+ BooleanOption('dom.report_all_js_exceptions', true),
+ BooleanOption('javascript.options.showInConsole', true),
+ IntegerOption('network.http.max-connections-per-server', 10),
+ StringOption('startup.homepage_welcome_url', 'about:blank'),
+ BooleanOption('webdriver_accept_untrusted_certs', true),
+ BooleanOption('webdriver_assume_untrusted_issuer', true),
];
/// Creates a Firefox profile in a format so it can be passed using the
@@ -101,19 +101,19 @@
class FirefoxProfile {
final io.Directory profileDirectory;
- Set<PrefsOption> _prefs = new Set<PrefsOption>();
+ Set<PrefsOption> _prefs = Set<PrefsOption>();
/// The read-only settings of the `prefs.js` file of the profile directory.
- List<PrefsOption> get prefs => new UnmodifiableListView<PrefsOption>(_prefs);
+ List<PrefsOption> get prefs => UnmodifiableListView<PrefsOption>(_prefs);
/// The settings of the `user.js` file of the profile directory overridden by
/// the settings in [lockedPrefs].
/// [setOption] and [removeOption] allow to update, add, and remove settings
/// except these included in [lockedPrefs].
- Set<PrefsOption> _userPrefs = new Set<PrefsOption>();
+ Set<PrefsOption> _userPrefs = Set<PrefsOption>();
List<PrefsOption> get userPrefs =>
- new UnmodifiableListView<PrefsOption>(_userPrefs);
+ UnmodifiableListView<PrefsOption>(_userPrefs);
/// Creates a new FirefoxProfile.
///
@@ -131,13 +131,13 @@
_userPrefs.addAll(defaultUserPrefs);
if (profileDirectory != null) {
final prefsFile =
- new io.File(path.join(profileDirectory.absolute.path, 'prefs.js'));
+ io.File(path.join(profileDirectory.absolute.path, 'prefs.js'));
if (prefsFile.existsSync()) {
_prefs = loadPrefsFile(prefsFile);
}
final userPrefsFile =
- new io.File(path.join(profileDirectory.absolute.path, 'user.js'));
+ io.File(path.join(profileDirectory.absolute.path, 'user.js'));
if (userPrefsFile.existsSync()) {
_userPrefs = loadPrefsFile(userPrefsFile)
.where((option) => !lockedPrefs.contains(option))
@@ -168,7 +168,7 @@
/// contains it.
bool removeOption(String name) {
final option = _userPrefs.firstWhere((o) => o.name == name,
- orElse: () => new InvalidOption(name));
+ orElse: () => InvalidOption(name));
if (option is InvalidOption) {
return false;
}
@@ -195,13 +195,13 @@
/// is otherwise ignored.
/// Comments, lines starting with `//` are silently ignored.
static Set<PrefsOption> loadPrefsFile(io.File file) {
- final prefs = new Set<PrefsOption>();
+ final prefs = Set<PrefsOption>();
final lines = LineSplitter.split(file.readAsStringSync())
.where((line) => !_ignoreLine(line));
bool canNotParseCaption = true;
for (final line in lines) {
- final option = new PrefsOption.parse(line);
+ final option = PrefsOption.parse(line);
if (option is InvalidOption) {
if (canNotParseCaption) {
print('Can\'t parse lines from file "${file.path}":');
@@ -223,19 +223,19 @@
/// It can be uses like
/// `var desired = Capabilities.firefox..addAll(firefoxProfile.toJson()}`
Map toJson() {
- Archive archive = new Archive();
+ Archive archive = Archive();
if (profileDirectory != null) {
profileDirectory.listSync(recursive: true).forEach((f) {
ArchiveFile archiveFile;
final name = path.relative(f.path, from: profileDirectory.path);
if (f is io.Directory) {
- archiveFile = new ArchiveFile('$name/', 0, <int>[]);
+ archiveFile = ArchiveFile('$name/', 0, <int>[]);
} else if (f is io.File) {
if (name == 'prefs.js' || name == 'user.js') {
return;
}
archiveFile =
- new ArchiveFile(name, f.statSync().size, (f).readAsBytesSync());
+ ArchiveFile(name, f.statSync().size, (f).readAsBytesSync());
} else {
throw 'Invalid file type for file "${f.path}" '
'(${io.FileSystemEntity.typeSync(f.path)}).';
@@ -246,14 +246,14 @@
final prefsJsContent =
prefs.map((option) => option.asPrefString).join('\n').codeUnits;
archive.addFile(
- new ArchiveFile('prefs.js', prefsJsContent.length, prefsJsContent));
+ ArchiveFile('prefs.js', prefsJsContent.length, prefsJsContent));
final userJsContent =
userPrefs.map((option) => option.asPrefString).join('\n').codeUnits;
- archive.addFile(
- new ArchiveFile('user.js', userJsContent.length, userJsContent));
+ archive
+ .addFile(ArchiveFile('user.js', userJsContent.length, userJsContent));
- final zipData = new ZipEncoder().encode(archive);
+ final zipData = ZipEncoder().encode(archive);
return {'firefox_profile': base64.encode(zipData)};
}
}
@@ -267,7 +267,7 @@
/// this pattern will not match that line because Firefox never generates
/// lines like that.
static final RegExp _preferencePattern =
- new RegExp(r'user_pref\("([^"]+)", ("?.+?"?)\);');
+ RegExp(r'user_pref\("([^"]+)", ("?.+?"?)\);');
final String name;
T _value;
@@ -277,11 +277,11 @@
factory PrefsOption(String name, value) {
assert(value is bool || value is int || value is String);
if (value is bool) {
- return new BooleanOption(name, value) as PrefsOption<T>;
+ return BooleanOption(name, value) as PrefsOption<T>;
} else if (value is int) {
- return new IntegerOption(name, value) as PrefsOption<T>;
+ return IntegerOption(name, value) as PrefsOption<T>;
} else if (value is String) {
- return new StringOption(name, value) as PrefsOption<T>;
+ return StringOption(name, value) as PrefsOption<T>;
}
return null;
}
@@ -289,7 +289,7 @@
factory PrefsOption.parse(String prefs) {
final match = _preferencePattern.firstMatch(prefs);
if (match == null) {
- return new InvalidOption('Not a valid prefs option: "$prefs".')
+ return InvalidOption('Not a valid prefs option: "$prefs".')
as PrefsOption<T>;
}
final name = match.group(1);
@@ -299,18 +299,18 @@
.substring(1, valueString.length - 1)
.replaceAll(r'\"', r'"')
.replaceAll(r'\\', r'\');
- return new StringOption(name, value) as PrefsOption<T>;
+ return StringOption(name, value) as PrefsOption<T>;
}
if (valueString.toLowerCase() == 'true') {
- return new BooleanOption(name, true) as PrefsOption<T>;
+ return BooleanOption(name, true) as PrefsOption<T>;
} else if (valueString.toLowerCase() == 'false') {
- return new BooleanOption(name, false) as PrefsOption<T>;
+ return BooleanOption(name, false) as PrefsOption<T>;
}
try {
int value = int.parse(valueString);
- return new IntegerOption(name, value) as PrefsOption<T>;
+ return IntegerOption(name, value) as PrefsOption<T>;
} catch (_) {}
- return new InvalidOption('Not a valid prefs option: "$prefs".')
+ return InvalidOption('Not a valid prefs option: "$prefs".')
as PrefsOption<T>;
}
diff --git a/lib/support/forwarder.dart b/lib/support/forwarder.dart
index 5828f87..5c9fcf8 100644
--- a/lib/support/forwarder.dart
+++ b/lib/support/forwarder.dart
@@ -22,8 +22,7 @@
import 'package:webdriver/async_core.dart'
show By, WebDriver, WebDriverException;
-final _contentTypeJson =
- new ContentType('application', 'json', charset: 'utf-8');
+final _contentTypeJson = ContentType('application', 'json', charset: 'utf-8');
/// Attribute on elements used to locate them on passed WebDriver commands.
const wdElementIdAttribute = 'wd-element-id';
@@ -69,7 +68,7 @@
bool useDeep;
WebDriverForwarder(this.driver,
- {this.prefix: '/webdriver', Directory outputDir, this.useDeep: false})
+ {this.prefix = '/webdriver', Directory outputDir, this.useDeep = false})
: this.outputDir = outputDir == null
? Directory.systemTemp.createTempSync()
: outputDir;
@@ -132,7 +131,7 @@
case 'screenshot':
if (method == 'POST') {
// take a screenshot and save to file system
- var file = new File(path.join(outputDir.path, params['file']));
+ var file = File(path.join(outputDir.path, params['file']));
await file.writeAsBytes(await driver.captureScreenshotAsList());
return null;
}
@@ -140,7 +139,7 @@
case 'source':
if (method == 'POST') {
// grab page source and save to file system
- await new File(path.join(outputDir.path, params['file']))
+ await File(path.join(outputDir.path, params['file']))
.writeAsString(await driver.pageSource);
return null;
}
@@ -160,7 +159,7 @@
// several /touch/... endpoints and the /moveto endpoint have an
// optional 'element' param with a WebElement id value
if (params['element'] != null) {
- params = new Map.from(params);
+ params = Map.from(params);
params['element'] = await _findElement(params['element']);
}
break;
@@ -189,8 +188,7 @@
if (useDeep) {
selector = '* /deep/ $selector';
}
- var elements =
- await driver.findElements(new By.cssSelector(selector)).toList();
+ var elements = await driver.findElements(By.cssSelector(selector)).toList();
return elements.single.id;
}
diff --git a/lib/support/stdio_stepper.dart b/lib/support/stdio_stepper.dart
index 8744410..bbf9af8 100644
--- a/lib/support/stdio_stepper.dart
+++ b/lib/support/stdio_stepper.dart
@@ -24,7 +24,7 @@
/// A [LineReader] instance connected to 'dart:io' [stdin].
LineReader get stdinLineReader {
- _stdinLineReader ??= new LineReader(stdin);
+ _stdinLineReader ??= LineReader(stdin);
return _stdinLineReader;
}
@@ -52,7 +52,7 @@
return false;
case 'break':
case 'b':
- throw new Exception('process ended by user.');
+ throw Exception('process ended by user.');
case 'help':
case 'h':
_printUsage();
@@ -69,7 +69,7 @@
print('invalid command: `$command` enter `h` or `help` for help.');
}
}
- throw new Exception('stdin has been closed');
+ throw Exception('stdin has been closed');
}
void _printUsage() {
@@ -90,14 +90,14 @@
bool _crPrevious = false;
final _bytes = <int>[];
- final _controller = new StreamController<String>.broadcast();
+ final _controller = StreamController<String>.broadcast();
final Encoding encoding;
/// Only encodings that are a superset of ASCII are supported
/// TODO(DrMarcII): Support arbitrary encodings
LineReader(Stream /* <List<int> | int> */ stream,
- {this.encoding: SYSTEM_ENCODING}) {
+ {this.encoding = SYSTEM_ENCODING}) {
if (stream is Stdin) {
stdin.lineMode = false;
}
diff --git a/lib/sync_core.dart b/lib/sync_core.dart
index 8a57772..336889a 100644
--- a/lib/sync_core.dart
+++ b/lib/sync_core.dart
@@ -69,12 +69,8 @@
throw 'Unexpected spec: ${session.spec}';
}
- return new WebDriver(
- uri,
- session.id,
- new UnmodifiableMapView(session.capabilities),
- createRequestClient(uri.resolve('session/${session.id}/')),
- session.spec);
+ return WebDriver(uri, session.id, UnmodifiableMapView(session.capabilities),
+ createRequestClient(uri.resolve('session/${session.id}/')), session.spec);
}
/// Creates a sync WebDriver from existing session.
@@ -88,7 +84,7 @@
Map<String, dynamic> capabilities}) {
uri ??= defaultUri;
- var session = new SessionInfo(sessionId, spec, capabilities);
+ var session = SessionInfo(sessionId, spec, capabilities);
// Update session info if not all is provided.
if (spec == WebDriverSpec.Auto || capabilities == null) {
@@ -106,10 +102,6 @@
throw 'Unexpected spec: ${session.spec}';
}
- return new WebDriver(
- uri,
- session.id,
- new UnmodifiableMapView(session.capabilities),
- createRequestClient(uri.resolve('session/${session.id}/')),
- session.spec);
+ return WebDriver(uri, session.id, UnmodifiableMapView(session.capabilities),
+ createRequestClient(uri.resolve('session/${session.id}/')), session.spec);
}
diff --git a/lib/sync_io.dart b/lib/sync_io.dart
index 9be70f6..b3fdd88 100644
--- a/lib/sync_io.dart
+++ b/lib/sync_io.dart
@@ -32,7 +32,7 @@
{Uri uri,
Map<String, dynamic> desired,
core.WebDriverSpec spec = core.WebDriverSpec.Auto}) =>
- core.createDriver((prefix) => new SyncHttpRequestClient(prefix),
+ core.createDriver((prefix) => SyncHttpRequestClient(prefix),
uri: uri, desired: desired, spec: spec);
/// Creates a sync WebDriver from existing session using
@@ -51,5 +51,5 @@
core.WebDriverSpec spec = core.WebDriverSpec.Auto,
Map<String, dynamic> capabilities}) =>
core.fromExistingSession(
- sessionId, (prefix) => new SyncHttpRequestClient(prefix),
+ sessionId, (prefix) => SyncHttpRequestClient(prefix),
uri: uri, spec: spec, capabilities: capabilities);
diff --git a/test/async_alert_test.dart b/test/async_alert_test.dart
index 6db5734..d3af4b6 100644
--- a/test/async_alert_test.dart
+++ b/test/async_alert_test.dart
@@ -78,5 +78,5 @@
await alert.accept();
expect(await output.text, endsWith('some keys'));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_cookies_test.dart b/test/async_cookies_test.dart
index 4257232..a8d87da 100644
--- a/test/async_cookies_test.dart
+++ b/test/async_cookies_test.dart
@@ -37,15 +37,15 @@
});
test('add simple cookie and get', () async {
- await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
+ await driver.cookies.add(Cookie('mycookie', 'myvalue'));
final cookie = await driver.cookies.getCookie('mycookie');
expect(cookie.value, 'myvalue');
});
test('add complex cookie and get', () async {
- var date = new DateTime.utc(2020);
- await driver.cookies.add(new Cookie('mycookie', 'myvalue',
+ var date = DateTime.utc(2020);
+ await driver.cookies.add(Cookie('mycookie', 'myvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
final cookie = await driver.cookies.getCookie('mycookie');
@@ -54,9 +54,9 @@
});
test('get all cookies', () async {
- await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
- var date = new DateTime.utc(2020);
- await driver.cookies.add(new Cookie('mycomplexcookie', 'mycomplexvalue',
+ await driver.cookies.add(Cookie('mycookie', 'myvalue'));
+ var date = DateTime.utc(2020);
+ await driver.cookies.add(Cookie('mycomplexcookie', 'mycomplexvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
bool found = false;
@@ -84,7 +84,7 @@
});
test('delete cookie', () async {
- await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
+ await driver.cookies.add(Cookie('mycookie', 'myvalue'));
await driver.cookies.delete('mycookie');
bool found = false;
await for (var cookie in driver.cookies.all) {
@@ -101,9 +101,9 @@
// "come back" after a short amount of time.
// So instead, we plant two cookies and test that they are actually
// removed by [deleteAll].
- await driver.cookies.add(new Cookie('mycookie', 'myvalue'));
- var date = new DateTime.utc(2020);
- await driver.cookies.add(new Cookie('mycomplexcookie', 'mycomplexvalue',
+ await driver.cookies.add(Cookie('mycookie', 'myvalue'));
+ var date = DateTime.utc(2020);
+ await driver.cookies.add(Cookie('mycomplexcookie', 'mycomplexvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
await driver.cookies.deleteAll();
diff --git a/test/async_keyboard_test.dart b/test/async_keyboard_test.dart
index 4ef164f..5a9c23a 100644
--- a/test/async_keyboard_test.dart
+++ b/test/async_keyboard_test.dart
@@ -73,5 +73,5 @@
await driver.keyboard.sendKeys('xxx');
expect(await textInput.properties['value'], 'xxx');
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_logs_test.dart b/test/async_logs_test.dart
index edb30c9..bf38610 100644
--- a/test/async_logs_test.dart
+++ b/test/async_logs_test.dart
@@ -49,5 +49,5 @@
expect(entry.level, equals(LogLevel.info));
});
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_mouse_test.dart b/test/async_mouse_test.dart
index 70ed075..a5f4e41 100644
--- a/test/async_mouse_test.dart
+++ b/test/async_mouse_test.dart
@@ -77,5 +77,5 @@
var alert = await driver.switchTo.alert;
await alert.dismiss();
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_navigation_test.dart b/test/async_navigation_test.dart
index a25c15a..6777626 100644
--- a/test/async_navigation_test.dart
+++ b/test/async_navigation_test.dart
@@ -50,5 +50,5 @@
return 'expected StaleElementReferenceException';
});
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_target_locator_test.dart b/test/async_target_locator_test.dart
index c25f8ce..772d93e 100644
--- a/test/async_target_locator_test.dart
+++ b/test/async_target_locator_test.dart
@@ -61,5 +61,5 @@
await driver.switchTo.frame();
await driver.findElement(const By.tagName('button'));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_timeouts_test.dart b/test/async_timeouts_test.dart
index 6c158ee..bfbaae1 100644
--- a/test/async_timeouts_test.dart
+++ b/test/async_timeouts_test.dart
@@ -41,5 +41,5 @@
await driver.timeouts.setImplicitTimeout(const Duration(seconds: 1));
await driver.timeouts.setPageLoadTimeout(const Duration(seconds: 10));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_web_driver_test.dart b/test/async_web_driver_test.dart
index a0bff9a..3c26d9e 100644
--- a/test/async_web_driver_test.dart
+++ b/test/async_web_driver_test.dart
@@ -180,7 +180,7 @@
test('future based event listeners work with script timeouts', () async {
driver.addEventListener((WebDriverCommandEvent e) async {
- return await new Future.delayed(
+ return await Future.delayed(
const Duration(milliseconds: 1000), (() {}));
});
@@ -198,8 +198,7 @@
int millisDelay = 2000;
int current = 0;
driver.addEventListener((WebDriverCommandEvent e) async {
- return await new Future.delayed(
- new Duration(milliseconds: millisDelay), (() {
+ return await Future.delayed(Duration(milliseconds: millisDelay), (() {
eventList.add(current++);
millisDelay = (millisDelay / 2).round();
}));
@@ -214,5 +213,5 @@
}
});
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_web_element_test.dart b/test/async_web_element_test.dart
index 5a8c3af..4729a45 100644
--- a/test/async_web_element_test.dart
+++ b/test/async_web_element_test.dart
@@ -193,5 +193,5 @@
var element = await driver.findElement(const By.cssSelector('table'));
expect(await element.equals(table), isTrue);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/async_window_test.dart b/test/async_window_test.dart
index a95a865..df3a6c0 100644
--- a/test/async_window_test.dart
+++ b/test/async_window_test.dart
@@ -44,7 +44,7 @@
var size = const Rectangle<int>(0, 0, 600, 400);
// Firefox may take a bit longer to do the resize.
- await new Future.delayed(const Duration(seconds: 1));
+ await Future.delayed(const Duration(seconds: 1));
await window.setSize(size);
expect(await window.size, size);
});
@@ -75,5 +75,5 @@
expect(size.height, greaterThan(200));
expect(size.width, greaterThan(300));
}, skip: 'unreliable');
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/configs/async_io_config.dart b/test/configs/async_io_config.dart
index def04f8..b99a2fa 100644
--- a/test/configs/async_io_config.dart
+++ b/test/configs/async_io_config.dart
@@ -45,7 +45,7 @@
server.listen((request) {
if (request.method == 'GET' && request.uri.path.endsWith('.html')) {
String testPagePath = '$testHomePath${request.uri.path}';
- File file = new File(testPagePath);
+ File file = File(testPagePath);
if (file.existsSync()) {
request.response
..statusCode = HttpStatus.ok
diff --git a/test/configs/sync_io_config.dart b/test/configs/sync_io_config.dart
index a956cfa..a090bed 100644
--- a/test/configs/sync_io_config.dart
+++ b/test/configs/sync_io_config.dart
@@ -29,7 +29,7 @@
WebDriver createTestDriver(
{Map<String, dynamic> additionalCapabilities,
- WebDriverSpec spec: WebDriverSpec.W3c}) {
+ WebDriverSpec spec = WebDriverSpec.W3c}) {
final capabilities = getCapabilities(spec);
if (additionalCapabilities != null) {
capabilities.addAll(additionalCapabilities);
@@ -42,7 +42,7 @@
server.listen((request) {
if (request.method == 'GET' && request.uri.path.endsWith('.html')) {
String testPagePath = '$testHomePath${request.uri.path}';
- File file = new File(testPagePath);
+ File file = File(testPagePath);
if (file.existsSync()) {
request.response
..statusCode = HttpStatus.ok
diff --git a/test/support/async_test.dart b/test/support/async_test.dart
index 1530b19..6b903b5 100644
--- a/test/support/async_test.dart
+++ b/test/support/async_test.dart
@@ -22,7 +22,7 @@
void main() {
group('Lock', () {
test('basic acquire/release', () async {
- var lock = new Lock();
+ var lock = Lock();
expect(lock.isHeld, isFalse);
await lock.acquire();
expect(lock.isHeld, isTrue);
@@ -34,26 +34,26 @@
});
test('release without acquiring fails', () {
- var lock = new Lock();
+ var lock = Lock();
expect(() => lock.release(), throwsA(const isInstanceOf<StateError>()));
});
test('locking prevents acquisition of lock', () async {
- var lock = new Lock();
+ var lock = Lock();
var secondLockAcquired = false;
await lock.acquire();
lock.acquire().then((_) => secondLockAcquired = true);
// Make sure that lock is not unacquired just because of timing
- await new Future.delayed(const Duration(seconds: 1));
+ await Future.delayed(const Duration(seconds: 1));
expect(secondLockAcquired, isFalse);
lock.release();
// Make sure that enough time has occurred that lock is acquired
- await new Future.delayed(const Duration(seconds: 1));
+ await Future.delayed(const Duration(seconds: 1));
expect(secondLockAcquired, isTrue);
});
test('awaitChecking throws exception on acquire of held lock', () async {
- var lock = new Lock(awaitChecking: true);
+ var lock = Lock(awaitChecking: true);
await lock.acquire();
expect(lock.acquire(), throwsA(anything));
lock.release();
@@ -63,7 +63,7 @@
});
group('Clock.waitFor', () {
- var clock = new FakeClock();
+ var clock = FakeClock();
test('that returns a string', () async {
var count = 0;
@@ -128,7 +128,7 @@
});
test('uses Future value', () async {
- var result = await clock.waitFor(() => new Future.value('a value'),
+ var result = await clock.waitFor(() => Future.value('a value'),
matcher: 'a value');
expect(result, 'a value');
});
@@ -137,7 +137,7 @@
var exception;
try {
- await clock.waitFor(() => new Future.error('an exception'));
+ await clock.waitFor(() => Future.error('an exception'));
} catch (e) {
exception = e;
}
@@ -179,12 +179,12 @@
}
expect(exception, isNotNull);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
/// FakeClock for testing waitFor functionality.
class FakeClock extends Clock {
- var _now = new DateTime(2020);
+ var _now = DateTime(2020);
@override
DateTime get now => _now;
@@ -192,6 +192,6 @@
@override
Future sleep([Duration interval = defaultInterval]) {
_now = _now.add(interval);
- return new Future.value();
+ return Future.value();
}
}
diff --git a/test/support/firefox_profile_test.dart b/test/support/firefox_profile_test.dart
index 830c770..bbb992a 100644
--- a/test/support/firefox_profile_test.dart
+++ b/test/support/firefox_profile_test.dart
@@ -31,7 +31,7 @@
r'7e08-4474-a285-3208198ce6fd}\":{\"d\":\"/opt/firefox/browser/'
r'extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}\",\"e\":true,\'
r'"v\":\"40.0\",\"st\":1439535413000,\"mt\":1438968709000}}}");';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<StringOption>());
expect(option.asPrefString, value);
});
@@ -39,21 +39,21 @@
test('parse and serialize string value with backslash', () {
const value = r'user_pref("browser.cache.disk.parent_directory", '
r'"\\\\volume\\web\\cache\\mz");';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<StringOption>());
expect(option.asPrefString, value);
});
test('parse and serialize integer value', () {
const value = r'user_pref("browser.cache.frecency_experiment", 3);';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<IntegerOption>());
expect(option.asPrefString, value);
});
test('parse and serialize negative integer value', () {
const value = r'user_pref("browser.cache.frecency_experiment", -3);';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<IntegerOption>());
expect(option.asPrefString, value);
});
@@ -61,7 +61,7 @@
test('parse and serialize boolean true', () {
const value =
r'user_pref("browser.cache.disk.smart_size.first_run", true);';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<BooleanOption>());
expect(option.asPrefString, value);
});
@@ -69,7 +69,7 @@
test('parse and serialize boolean false', () {
const value =
r'user_pref("browser.cache.disk.smart_size.first_run", false);';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<BooleanOption>());
expect(option.asPrefString, value);
});
@@ -77,15 +77,15 @@
test('parse boolean uppercase True', () {
const value =
r'user_pref("browser.cache.disk.smart_size.first_run", True);';
- var option = new PrefsOption.parse(value);
+ var option = PrefsOption.parse(value);
expect(option, const isInstanceOf<BooleanOption>());
expect(option.value, true);
});
test('added value should be in prefs', () {
- var profile = new FirefoxProfile();
+ var profile = FirefoxProfile();
var option =
- new PrefsOption('browser.bookmarks.restore_default_bookmarks', false);
+ PrefsOption('browser.bookmarks.restore_default_bookmarks', false);
expect(profile.setOption(option), true);
@@ -96,8 +96,8 @@
});
test('overriding locked value should be ignored', () {
- var profile = new FirefoxProfile();
- var lockedOption = new PrefsOption('javascript.enabled', false);
+ var profile = FirefoxProfile();
+ var lockedOption = PrefsOption('javascript.enabled', false);
var lockedOptionOrig =
profile.prefs.firstWhere((e) => e.name == lockedOption.name);
expect(lockedOption.value, isNot(lockedOptionOrig.value));
@@ -110,8 +110,8 @@
});
test('removing locked value should be ignored', () {
- var profile = new FirefoxProfile();
- var lockedOption = new PrefsOption('javascript.enabled', false);
+ var profile = FirefoxProfile();
+ var lockedOption = PrefsOption('javascript.enabled', false);
var lockedOptionOrig =
profile.prefs.firstWhere((e) => e.name == lockedOption.name);
expect(lockedOption.value, isNot(lockedOptionOrig.value));
@@ -124,8 +124,8 @@
});
test('encode/decode "user.js" in-memory', () {
- var profile = new FirefoxProfile();
- profile.setOption(new PrefsOption(Capabilities.hasNativeEvents, true));
+ var profile = FirefoxProfile();
+ profile.setOption(PrefsOption(Capabilities.hasNativeEvents, true));
var archive = unpackArchiveData(profile.toJson());
@@ -134,9 +134,8 @@
expectedFiles.forEach((f) => expect(
archive.files, anyElement((ArchiveFile f) => f.name == 'prefs.js')));
- var prefs = FirefoxProfile.loadPrefsFile(new MockFile(
- new String.fromCharCodes(
- archive.files.firstWhere((f) => f.name == 'user.js').content)));
+ var prefs = FirefoxProfile.loadPrefsFile(MockFile(String.fromCharCodes(
+ archive.files.firstWhere((f) => f.name == 'user.js').content)));
expect(
prefs,
anyElement((PrefsOption o) =>
@@ -144,9 +143,9 @@
});
test('encode/decode profile directory from disk', () {
- var profile = new FirefoxProfile(
- profileDirectory: new io.Directory('test/support/firefox_profile'));
- profile.setOption(new PrefsOption(Capabilities.hasNativeEvents, true));
+ var profile = FirefoxProfile(
+ profileDirectory: io.Directory('test/support/firefox_profile'));
+ profile.setOption(PrefsOption(Capabilities.hasNativeEvents, true));
var archive = unpackArchiveData(profile.toJson());
@@ -161,20 +160,19 @@
expectedFiles.forEach((f) => expect(
archive.files, anyElement((ArchiveFile f) => f.name == 'prefs.js')));
- var prefs = FirefoxProfile.loadPrefsFile(new MockFile(
- new String.fromCharCodes(
- archive.files.firstWhere((f) => f.name == 'user.js').content)));
+ var prefs = FirefoxProfile.loadPrefsFile(MockFile(String.fromCharCodes(
+ archive.files.firstWhere((f) => f.name == 'user.js').content)));
expect(
prefs,
anyElement((PrefsOption o) =>
o.name == Capabilities.hasNativeEvents && o.value == true));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
Archive unpackArchiveData(Map profileData) {
var zipArchive = base64.decode(profileData['firefox_profile']);
- return new ZipDecoder().decodeBytes(zipArchive, verify: true);
+ return ZipDecoder().decodeBytes(zipArchive, verify: true);
}
/// Simulate file for `FirefoxProfile.loadPrefsFile()`
@@ -184,7 +182,7 @@
MockFile(this.content);
@override
- String readAsStringSync({Encoding encoding: utf8}) => content;
+ String readAsStringSync({Encoding encoding = utf8}) => content;
@override
dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
diff --git a/test/support/forwarder_test.dart b/test/support/forwarder_test.dart
index 6b05b47..5b1c31e 100644
--- a/test/support/forwarder_test.dart
+++ b/test/support/forwarder_test.dart
@@ -36,8 +36,7 @@
setUp(() async {
driver = await config.createTestDriver();
- forwarder =
- new WebDriverForwarder(driver, prefix: '/webdriver/session/1');
+ forwarder = WebDriverForwarder(driver, prefix: '/webdriver/session/1');
server = await config.createLocalServer();
server.listen((request) {
@@ -46,7 +45,7 @@
} else if (request.method == 'GET' &&
request.uri.path.endsWith('test_page.html')) {
String testPagePath = config.forwarderTestPagePath;
- File file = new File(testPagePath);
+ File file = File(testPagePath);
request.response
..statusCode = HttpStatus.ok
..headers.set('Content-type', 'text/html');
@@ -57,7 +56,7 @@
..close();
}
});
- address = new Uri.http('localhost:${server.port}', '/webdriver/');
+ address = Uri.http('localhost:${server.port}', '/webdriver/');
forwardedDriver =
fromExistingSessionSync('1', WebDriverSpec.JsonWire, uri: address);
@@ -152,5 +151,5 @@
test('window close', () async {
await (await forwardedDriver.window).close();
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/alert.dart b/test/sync/alert.dart
index 5f10f96..5368987 100644
--- a/test/sync/alert.dart
+++ b/test/sync/alert.dart
@@ -78,5 +78,5 @@
alert.accept();
expect(output.text, endsWith('some keys'));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/basic_sync.dart b/test/sync/basic_sync.dart
index 5fb2f41..bd43621 100644
--- a/test/sync/basic_sync.dart
+++ b/test/sync/basic_sync.dart
@@ -45,5 +45,5 @@
test('can do basic delete', () {
driver.cookies.deleteAll(); // This is a DELETE request.
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/command_event.dart b/test/sync/command_event.dart
index c39fb51..a92821c 100644
--- a/test/sync/command_event.dart
+++ b/test/sync/command_event.dart
@@ -61,5 +61,5 @@
expect(events[1].startTime.isBefore(events[1].endTime), isTrue);
expect(events[1].stackTrace, const TypeMatcher<Chain>());
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/cookies.dart b/test/sync/cookies.dart
index 137e7f2..1bd1a67 100644
--- a/test/sync/cookies.dart
+++ b/test/sync/cookies.dart
@@ -37,15 +37,15 @@
});
test('add simple cookie and get', () {
- driver.cookies.add(new Cookie('mycookie', 'myvalue'));
+ driver.cookies.add(Cookie('mycookie', 'myvalue'));
final cookie = driver.cookies.getCookie('mycookie');
expect(cookie.value, 'myvalue');
});
test('add complex cookie and get', () {
- var date = new DateTime.utc(2020);
- driver.cookies.add(new Cookie('mycookie', 'myvalue',
+ var date = DateTime.utc(2020);
+ driver.cookies.add(Cookie('mycookie', 'myvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
final cookie = driver.cookies.getCookie('mycookie');
@@ -54,9 +54,9 @@
});
test('get all cookies', () {
- driver.cookies.add(new Cookie('mycookie', 'myvalue'));
- var date = new DateTime.utc(2020);
- driver.cookies.add(new Cookie('mycomplexcookie', 'mycomplexvalue',
+ driver.cookies.add(Cookie('mycookie', 'myvalue'));
+ var date = DateTime.utc(2020);
+ driver.cookies.add(Cookie('mycomplexcookie', 'mycomplexvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
bool found = false;
@@ -83,7 +83,7 @@
});
test('delete cookie', () {
- driver.cookies.add(new Cookie('mycookie', 'myvalue'));
+ driver.cookies.add(Cookie('mycookie', 'myvalue'));
driver.cookies.delete('mycookie');
bool found = false;
for (var cookie in driver.cookies.all) {
@@ -100,9 +100,9 @@
// "come back" after a short amount of time.
// So instead, we plant two cookies and test that they are actually
// removed by [deleteAll].
- driver.cookies.add(new Cookie('mycookie', 'myvalue'));
- var date = new DateTime.utc(2020);
- driver.cookies.add(new Cookie('mycomplexcookie', 'mycomplexvalue',
+ driver.cookies.add(Cookie('mycookie', 'myvalue'));
+ var date = DateTime.utc(2020);
+ driver.cookies.add(Cookie('mycomplexcookie', 'mycomplexvalue',
path: '/', domain: '.google.com', secure: false, expiry: date));
driver.cookies.deleteAll();
@@ -117,5 +117,5 @@
expect(found, isFalse);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/keyboard.dart b/test/sync/keyboard.dart
index a824dfb..1709ada 100644
--- a/test/sync/keyboard.dart
+++ b/test/sync/keyboard.dart
@@ -72,5 +72,5 @@
driver.keyboard.sendKeys('xxx');
expect(textInput.properties['value'], 'xxx');
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/logs.dart b/test/sync/logs.dart
index b813136..4689d52 100644
--- a/test/sync/logs.dart
+++ b/test/sync/logs.dart
@@ -49,5 +49,5 @@
expect(entry.level, equals(LogLevel.info));
});
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/mouse.dart b/test/sync/mouse.dart
index f839fa9..4f3b3f8 100644
--- a/test/sync/mouse.dart
+++ b/test/sync/mouse.dart
@@ -102,5 +102,5 @@
var alert = driver.switchTo.alert;
alert.dismiss();
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/navigation.dart b/test/sync/navigation.dart
index 7d8cec3..4f16aa9 100644
--- a/test/sync/navigation.dart
+++ b/test/sync/navigation.dart
@@ -46,5 +46,5 @@
}
return 'expected Exception';
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/spec_inference_test.dart b/test/sync/spec_inference_test.dart
index 15f1bdf..b0321c2 100644
--- a/test/sync/spec_inference_test.dart
+++ b/test/sync/spec_inference_test.dart
@@ -62,5 +62,5 @@
await server.close(force: true);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/sync_async_interop.dart b/test/sync/sync_async_interop.dart
index 907ec20..c9f6006 100644
--- a/test/sync/sync_async_interop.dart
+++ b/test/sync/sync_async_interop.dart
@@ -65,5 +65,5 @@
expect(element.id, asyncElement.id);
expect(element.name, await asyncElement.name);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/target_locator.dart b/test/sync/target_locator.dart
index 0e7e88d..73dbee1 100644
--- a/test/sync/target_locator.dart
+++ b/test/sync/target_locator.dart
@@ -61,5 +61,5 @@
driver.switchTo.frame();
driver.findElement(const By.tagName('button'));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/timeouts.dart b/test/sync/timeouts.dart
index 628ec73..f69dedd 100644
--- a/test/sync/timeouts.dart
+++ b/test/sync/timeouts.dart
@@ -41,5 +41,5 @@
driver.timeouts.setImplicitTimeout(const Duration(seconds: 1));
driver.timeouts.setPageLoadTimeout(const Duration(seconds: 10));
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/web_driver.dart b/test/sync/web_driver.dart
index a099270..0e0010b 100644
--- a/test/sync/web_driver.dart
+++ b/test/sync/web_driver.dart
@@ -204,5 +204,5 @@
}
});
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/web_element.dart b/test/sync/web_element.dart
index e200ab8..ff7a39c 100644
--- a/test/sync/web_element.dart
+++ b/test/sync/web_element.dart
@@ -219,5 +219,5 @@
var element = driver.findElement(const By.cssSelector('table'));
expect(element.equals(table), isTrue);
});
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/sync/window.dart b/test/sync/window.dart
index c78fe3d..33f3ced 100644
--- a/test/sync/window.dart
+++ b/test/sync/window.dart
@@ -66,5 +66,5 @@
expect(finalRect.width, greaterThan(300));
expect(finalRect.height, greaterThan(300));
}, skip: 'Unreliable on Travis');
- }, timeout: const Timeout(const Duration(minutes: 2)));
+ }, timeout: const Timeout(Duration(minutes: 2)));
}