Commit 4d8f4f42 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Screenshot API for flutter driver (#6175)

parent 8ec4f229
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
import 'package:vm_service_client/vm_service_client.dart';
......@@ -267,6 +268,12 @@ class FlutterDriver {
return GetTextResult.fromJson(await _sendCommand(new GetText(finder))).text;
}
/// Take a screenshot. The image will be returned as a PNG.
Future<List<int>> screenshot() async {
Map<String, dynamic> result = await _peer.sendRequest('_flutter.screenshot');
return BASE64.decode(result['screenshot']);
}
/// Starts recording performance traces.
Future<Null> startTracing({List<TimelineStream> streams: _defaultStreams}) async {
assert(streams != null && streams.length > 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment