playwright method
WebSocketChannel
playwright({})
Protocol: WebSocket Connect to Chromium with any playwright style library.
Note: This endpoint is also available at: /playwright/chromium for backwards compatibility.
Summary: /chromium/playwright
Implementation
WebSocketChannel playwright({
bool? blockAds,
BrowserServerOptionsOrString? launch,
String? profile,
num? timeout,
String? token,
String? trackingId,
dynamic body,
}) {
final queryParams = <String, String>{};
if (defaultToken != null) {
queryParams['token'] = defaultToken!;
}
if (blockAds != null) {
queryParams['blockAds'] = blockAds.toString();
}
if (launch != null) {
queryParams['launch'] = launch.toString();
}
if (profile != null) {
queryParams['profile'] = profile.toString();
}
if (timeout != null) {
queryParams['timeout'] = timeout.toString();
}
if (token != null) {
queryParams['token'] = token.toString();
}
if (trackingId != null) {
queryParams['trackingId'] = trackingId.toString();
}
final pathUrl = '/chromium/playwright';
final uri = Uri.parse(
'$baseUrl$pathUrl',
).replace(queryParameters: queryParams.isNotEmpty ? queryParams : null);
final wsUri = uri.replace(scheme: uri.scheme == 'https' ? 'wss' : 'ws');
return WebSocketChannel.connect(wsUri);
}