Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/JSHandle/JSHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
use Playwright\Transport\TransportInterface;

/**
* @see https://playwright.dev/docs/api/class-jshandle
* Represents an in-page JavaScript object.
*
* The handle keeps a reference to a value evaluated in the page's JavaScript context.
* Dispose it when the handle is no longer needed to release browser resources.
*/
final class JSHandle implements JSHandleInterface
{
Expand Down
5 changes: 4 additions & 1 deletion src/Video/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
use Playwright\Transport\TransportInterface;

/**
* @see https://playwright.dev/docs/api/class-video
* Represents a recorded page video.
*
* The video exposes the local recording path and lets callers save or delete the file.
* File operations wait for the browser to finish writing the recording when needed.
*/
final class Video implements VideoInterface
{
Expand Down
22 changes: 18 additions & 4 deletions src/Video/VideoInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,38 @@
namespace Playwright\Video;

/**
* Represents a recorded page video.
*
* A video becomes available when its owning page or context finishes recording.
* Save or delete its local file after the browser has completed the recording.
*
* @see https://playwright.dev/docs/api/class-video
*/
interface VideoInterface
{
/**
* Deletes the video file. Will wait for the video to finish if necessary.
* Deletes the recording file.
*
* Waits for the browser to finish writing the video when necessary.
* The video cannot be saved from this object after deletion.
*/
public function delete(): void;

/**
* Returns the file system path this video will be recorded to.
* Returns the recording path.
*
* The path identifies the local file assigned to this video.
* The file may not exist until the browser finishes recording.
*/
public function path(): string;

/**
* Saves the video to a user-specified path.
* Saves the recording to a path.
*
* Waits for the browser to finish writing the source video when necessary.
* Creates the target directory when the implementation can do so.
*
* @param string $path Path where the video should be saved
* @param string $path Target file path
*/
public function saveAs(string $path): void;
}
5 changes: 4 additions & 1 deletion src/WebError/WebError.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
use Playwright\Page\PageInterface;

/**
* @see https://playwright.dev/docs/api/class-weberror
* Represents an unhandled page error.
*
* The error retains the exception reported by the browser runtime.
* The originating page is available when Playwright can associate one with the error.
*/
final class WebError implements WebErrorInterface
{
Expand Down
15 changes: 13 additions & 2 deletions src/WebError/WebErrorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,28 @@
use Playwright\Page\PageInterface;

/**
* Represents an unhandled page error.
*
* The exception comes from browser runtime code that did not handle it.
* A page is included when Playwright can associate the error with one.
*
* @see https://playwright.dev/docs/api/class-weberror
*/
interface WebErrorInterface
{
/**
* Unhandled error object.
* Returns the reported exception.
*
* The exception preserves the error type and message from the runtime.
* Inspect it to classify or report the unhandled browser error.
*/
public function error(): \Throwable;

/**
* The page that produced this unhandled exception, if any.
* Returns the originating page.
*
* A null result means the runtime did not associate the error with a page.
* The returned page can identify its URL or owning browser context.
*/
public function page(): ?PageInterface;
}
6 changes: 3 additions & 3 deletions src/WebSocket/WebSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
use Playwright\WebSocket\Options\WaitForEventOptions;

/**
* WebSocket implementation aligned with Playwright's WebSocket API.
* Supported events: 'close', 'framereceived', 'framesent', 'socketerror'.
* Represents a page WebSocket.
*
* @see https://playwright.dev/docs/api/class-websocket
* The socket exposes its URL and sends frames through the active page connection.
* Browser events report closes, frames, and errors through the event dispatcher.
*/
final class WebSocket implements WebSocketInterface, EventDispatcherInterface
{
Expand Down
6 changes: 6 additions & 0 deletions src/WebSocket/WebSocketInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

use Playwright\WebSocket\Options\WaitForEventOptions;

/**
* Represents a page WebSocket.
*
* The socket exposes its URL and browser-emitted lifecycle or frame events.
* Send frames or wait for socket activity through the active page connection.
*/
interface WebSocketInterface
{
/**
Expand Down
5 changes: 4 additions & 1 deletion src/Worker/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
use Playwright\Transport\TransportInterface;

/**
* @see https://playwright.dev/docs/api/class-worker
* Represents a web worker.
*
* JavaScript runs in the worker's own execution context.
* Returned handles stay associated with that worker until they are disposed.
*/
final class Worker implements WorkerInterface
{
Expand Down
Loading