screenshots

master
Steve Ayerhart 2021-08-23 23:53:29 -04:00
parent 4afeb73732
commit 83cb49a158
No known key found for this signature in database
GPG Key ID: 5C815FDF3A00B8BA
1 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
USING: kernel http http.client http.server io.pathnames io.encodings.string io.encodings.utf8 io.launcher accessors urls parser effects.parser words arrays sequences quotations json.reader json.writer formatting assocs namespaces present hashtables words.symbol combinators lexer calendar prettyprint.backend ;
USING: kernel http http.client http.server io.streams.byte-array io.pathnames io.encodings.binary io.encodings.string io.encodings.utf8 io.launcher accessors urls parser effects.parser words arrays sequences quotations json.reader json.writer formatting assocs namespaces present hashtables words.symbol combinators lexer calendar prettyprint.backend base64 images.png ;
USING: prettyprint ;
IN: web-driver
@ -257,6 +257,15 @@ TUPLE: rect x y width height ;
: delete-all-cookies ( -- )
"cookie" <session-delete-request> http-web-driver-request drop ;
! screen capture
: take-screenshot ( -- loading-png )
"screenshot" <session-get-request> http-web-driver-request
base64> binary <byte-reader> load-png ;
: take-element-screenshot ( element -- loading-png )
"screenshot" <element-get-request> http-web-driver-request base64> binary <byte-reader> load-png ;
! TODO: handle driver processes better
: <chrome-driver-stream> ( url capabilities -- stream )