-
-
Save vividsnow/729c90023001927108be to your computer and use it in GitHub Desktop.
Gtk3::WebKit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.16; | |
use Gtk3 -init; | |
use Gtk3::WebKit; | |
my ($file, $url, $wait) = ('out.png', 'http://yandex.ru'); | |
(my $view = Gtk3::WebKit::WebView->new)->set_transparent(Glib::TRUE); | |
(my $window = Gtk3::OffscreenWindow->new)->add($view); | |
$view->signal_connect('notify::load-status' => sub { if ($view->get_uri && $view->get_load_status eq 'finished') { | |
Glib::Timeout->add( $wait // 50, sub { | |
my $dom = $view->get_dom_document; | |
$dom->get_elements_by_class_name('b-head-tabs__tab')->item(3)->get_style->set_property( border=>'3px solid red', '' ); | |
$view->get_snapshot->write_to_png($file); | |
exit 0 } ) } } ); | |
$window->show_all; | |
$view->load_uri($url); | |
Gtk3->main; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment