Screenshot API for flutter driver (#6175)

This commit is contained in:
Jason Simmons
2016-10-03 12:26:30 -07:00
committed by GitHub
parent 8ec4f22941
commit 4d8f4f421a

View File

@@ -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);