connect static method
Starts WebDriver with the given settings
and
establishes the connection to Flutter Web application.
Implementation
static Future<FlutterWebConnection> connect(
String url,
Map<String, dynamic> settings,
{Duration? timeout}) async {
final String sessionId = settings['session-id'].toString();
final Uri sessionUri = Uri.parse(settings['session-uri'].toString());
final async_io.WebDriver driver = async_io.WebDriver(
sessionUri,
sessionId,
json.decode(settings['session-capabilities'] as String) as Map<String, dynamic>,
async_io.AsyncIoRequestClient(sessionUri.resolve('session/$sessionId/')),
async_io.WebDriverSpec.W3c,
);
if (settings['android-chrome-on-emulator'] == true) {
final Uri localUri = Uri.parse(url);
// Converts to Android Emulator Uri.
// Hardcode the host to 10.0.2.2 based on
// https://developer.android.com/studio/run/emulator-networking
url = Uri(scheme: localUri.scheme, host: '10.0.2.2', port:localUri.port).toString();
}
await driver.get(url);
await waitUntilExtensionInstalled(driver, timeout);
return FlutterWebConnection(driver, settings['support-timeline-action'] as bool);
}