diff --git a/lib/WWW/WebKit2.pm b/lib/WWW/WebKit2.pm index 7b246d1..6378a11 100644 --- a/lib/WWW/WebKit2.pm +++ b/lib/WWW/WebKit2.pm @@ -22,6 +22,8 @@ WWW::WebKit2 - Perl extension for controlling an embedding WebKit2 engine WWW::WebKit2 is a drop-in replacement for WWW::Selenium using Gtk3::WebKit2 as browser instead of relying on an external Java server and an installed browser. + +There are a range of browser settings available. Please check WWW::WebKit2::Settings for more information. =head2 EXPORT None by default. @@ -412,7 +414,6 @@ sub process_confirmation_prompt { } - sub pending { my ($self) = @_; @@ -425,6 +426,13 @@ sub process_events { Gtk3::main_iteration_do(0) while Gtk3::events_pending; } +=head2 process_page_load + +No parameters needed. +Method attempts to ensure the page has finished loading. This handling is primailary based on checking if GTK3 has any events pending + +=cut + sub process_page_load { my ($self) = @_; @@ -557,11 +565,11 @@ sub DESTROY { =head1 SEE ALSO See L for API documentation. -See L for a replacement for L. -See L for a replacement for L. +See L for a replacement for L. +See L for a replacement for L. The current development version can be found in the git repository at: -https://github.com/jscarty/WWW-WebKit2 +https://github.com/sorryforthecommit/WWW-WebKit2 =head1 AUTHOR diff --git a/lib/WWW/WebKit2/Inspector.pm b/lib/WWW/WebKit2/Inspector.pm index d58ac13..ffb0cc3 100644 --- a/lib/WWW/WebKit2/Inspector.pm +++ b/lib/WWW/WebKit2/Inspector.pm @@ -15,7 +15,7 @@ sub run_javascript { my $js_result = ''; $self->view->run_javascript("(function () {$javascript_string})()", undef, sub { - my ($object, $result, $user_data) = @_; + my ($object, $result) = @_; $done = 1; $js_result = $self->get_javascript_result($result, $raw, $javascript_string); }, undef); @@ -63,7 +63,7 @@ sub resolve_locator { $locator =~ s/'/\\'/g; - if (my ($css) = $locator =~ /^css=(.*)/) { + if ($locator =~ /^css=(.*)/) { return WWW::WebKit2::LocatorCSS->new({ locator_string => $locator, inspector => $self, @@ -113,7 +113,7 @@ sub get_html_source { return '' unless $resource; $resource->get_data(undef, sub { - my ($resource, $result, $user_data) = @_; + my ($resource, $result) = @_; $html_source = $resource->get_data_finish($result); $done = 1; diff --git a/lib/WWW/WebKit2/Locator.pm b/lib/WWW/WebKit2/Locator.pm index 4d10a2c..25707c7 100644 --- a/lib/WWW/WebKit2/Locator.pm +++ b/lib/WWW/WebKit2/Locator.pm @@ -361,7 +361,7 @@ sub fire_event { =cut sub is_visible { - my ($self, $attribute) = @_; + my ($self) = @_; my $search = $self->prepare_element; diff --git a/lib/WWW/WebKit2/Settings.pm b/lib/WWW/WebKit2/Settings.pm index 9df3fdb..f1fb8f0 100644 --- a/lib/WWW/WebKit2/Settings.pm +++ b/lib/WWW/WebKit2/Settings.pm @@ -4,6 +4,49 @@ use Carp qw(carp croak); use Glib qw(TRUE FALSE); use Moose::Role; +=head1 NAME + +WWW::WebKit2::Settings - setting management methods for webkit2 + +=cut + +=head1 DESCRIPTION + +Small list of methods for accessing Webkit2s built in methods. The full list of settings is here +https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html + +To enable or disable settings that are not here you can do +$self->settings->SETTINGNAME(TRUE/FALSE) +to enable webkit_settings_set_enable_javascript you just provide + +$self->settings->set_enable_javascript(TRUE) + +To disable: + +$self->settings->set_enable_javascript(FALSE) + +To check the status of a setting +$self->settings->get_SETTINGNAME; +if it is active you will get a one if it is not you will get 0 +webkit_settings_get_enable_javascript() +$self->settings->get_enable_javascript() + +Please note that some settings like +- webkit_settings_set_hardware_acceleration_policy +have specific commands for changing their settings. Please check the Webkit2 documentation for the exact parameters + +=cut + +=head2 On by default + +The settings below are turned on by default when webkit2->init is called. +- webkit_settings_set_enable_developer_extras +- webkit_settings_set_allow_file_access_from_file_urls +- webkit_settings_set_hardware_acceleration_policy + +=cut + + =head3 enable_file_access_from_file_urls =cut diff --git a/t/events.t b/t/events.t index 92bea12..3da378a 100644 --- a/t/events.t +++ b/t/events.t @@ -69,7 +69,6 @@ $webkit->wait_for_alert("blurred", 100); my $httpd = Test::Fake::HTTPD->new; $httpd->run(sub { - my $req = shift; return [ 200, [ 'Content-Type', 'text/html' ], [ read_text("$Bin/test/events.html") ] ]; }); diff --git a/t/logging.t b/t/logging.t index 6b2efbe..86ccccf 100644 --- a/t/logging.t +++ b/t/logging.t @@ -47,7 +47,7 @@ $webkit = WWW::WebKit2->new( ); $file = $webkit->write_log('another test'); -ok(-d "$dir/logs", 'log folder creted'); +ok(-d "$dir/logs", 'log folder created'); is(read_text($file), 'another test', 'log file written'); $webkit->open("$Bin/test/load.html"); diff --git a/t/test/keyboard.html b/t/test/keyboard.html index d691e53..171b168 100644 --- a/t/test/keyboard.html +++ b/t/test/keyboard.html @@ -3,7 +3,6 @@ events