createDriver function
WebDriver
createDriver(
- SyncRequestClient createRequestClient(
- Uri prefix
- Uri? uri,
- Map<
String, dynamic> ? desired, - WebDriverSpec spec = WebDriverSpec.Auto,
Creates a new sync WebDriver.
This is intended for internal use! Please use createDriver from sync_io.dart.
Implementation
WebDriver createDriver(
SyncRequestClient Function(Uri prefix) createRequestClient,
{Uri? uri,
Map<String, dynamic>? desired,
WebDriverSpec spec = WebDriverSpec.Auto}) {
uri ??= defaultUri;
// This client's prefix at root, it has no session prefix in it.
final client = createRequestClient(uri);
final handler = getHandler(spec);
final session = client.send(
handler.session.buildCreateRequest(desired: desired),
handler.session.parseCreateResponse);
if (session.spec != WebDriverSpec.JsonWire &&
session.spec != WebDriverSpec.W3c) {
throw 'Unexpected spec: ${session.spec}';
}
return WebDriver(uri, session.id, UnmodifiableMapView(session.capabilities!),
createRequestClient(uri.resolve('session/${session.id}/')), session.spec);
}