Page

A WWW::Playwright::Page is a single tab. Get one from Context.new-page.

goto(Str $url --> Int)#

Navigates to a URL and returns the HTTP status of the navigation response.

my $status = $page.goto('file:///path/to/hello.html');   # 200

url(--> Str)#

The current page URL.

my $url = $page.url;   # 'file:///path/to/hello.html'

title(--> Str)#

The document title.

my $title = $page.title;   # 'Hello'

locator(Str $selector --> Locator)#

Returns a Locator for the selector. This is the entry point to every action and query.

my $heading = $page.locator('#greeting');

screenshot(Str :$path --> Buf)#

Captures the page as a PNG and returns the bytes. With :path, also writes the image to that path.

my $bytes = $page.screenshot(path => '/tmp/page.png');

See Diagnostics.

close(--> Nil)#

Closes the page.

$page.close;