signatures';
use feature 'signatures';
use Future;
use Future::HTTP;
use Carp qw(croak carp);
use JSON;
use Data::Dumper;
use Chrome::DevToolsProtocol::Transport;
use Scalar::Util 'weaken', 'isweak';
=> (
is => 'ro',
default => 9222,
);
=item B<json>
The JSON decoder used
=cut
has 'json' => (
is => 'ro',
default => sub { JSON->new },
);
=item B<ua>
The L<Future::HTTP> instanc
point to talk to for the connected tab
=cut
has 'json_log_fh' => (
is => 'rw', # actually, it isn't really rw, but set-once
);
=head2 C<< json_log_fh >>
Filehandle where all communications wil
oo 2;
no warnings 'experimental::signatures';
use feature 'signatures';
use Carp qw( croak );
use JSON;
use Scalar::Util 'weaken';
=head1 NAME
WWW::Mechanize::Chrome::Node - represent a Chrome HTML
nt value of the attribute.
=cut
sub _false_to_undef( $val ) {
if( ref $val and ref $val eq 'JSON::PP::Boolean' ) {
$val = $val ? $val : undef;
}
return $val
}
sub _fetch_attribu
tId }, { value => $attribute } ],
objectId => $objectId,
returnByValue => JSON::true
)
})
->then(sub($res) {
$res = $res->{result}->{value};
ret
me::DevToolsProtocol;
use Chrome::DevToolsProtocol::Target;
use WWW::Mechanize::Chrome::Node;
use JSON;
use MIME::Base64 'decode_base64';
use Data::Dumper;
use Storable 'dclone';
use HTML::Selector::X
me's DevTools Protocol which implements the http protocol to
send JSON data structures. The host also responds to the client with JSON to
describe the web pages it has loaded. WMC conveniently hides t
s web resources on.
=item B<json_log_file>
Filename to log all JSON communications to, one line per message/event/reply
=item B<json_log_fh>
Filehandle to log all JSON communications to, one line
eDevTools;
use strict;
use Carp qw[croak];
our $VERSION = '0.75';
our @CARP_NOT;
use Moo 2;
use JSON;
use feature 'signatures';
no warnings 'experimental::signatures';
extends 'HTTP::Cookies';
=he
path,
domain => $domain,
httpOnly => JSON::false,
expires => $maxage,
secure => ($secure ? JSON::true : JSON::false),
);
};
sub save {
croak 'save is not
oo 2;
use experimental 'signatures';
use Future;
use Future::HTTP;
use Carp qw(croak carp);
use JSON;
use Data::Dumper;
use Chrome::DevToolsProtocol::Transport;
use Scalar::Util 'weaken', 'isweak';
Log::Log4perl->get_logger(__PACKAGE__);
}
=item B<json>
The JSON decoder used
=cut
has 'json' => (
is => 'ro',
default => sub { JSON->new },
);
=item B<tab>
Which tab to reuse (if any
%stack;
my $r;
sub on_response( $self, $connection, $message ) {
my $response = eval { $self->json->decode( $message ) };
if( $@ ) {
$self->log('error', $@ );
warn $message;