pub struct Coverage { /* private fields */ }Expand description
Provides JavaScript and CSS code coverage collection (Chromium only).
Access via Page::coverage.
Coverage collection is only supported in Chromium. Calling these methods on Firefox or WebKit will return an error.
Implementations§
Source§impl Coverage
impl Coverage
Sourcepub async fn start_js_coverage(
&self,
options: Option<StartJSCoverageOptions>,
) -> Result<()>
pub async fn start_js_coverage( &self, options: Option<StartJSCoverageOptions>, ) -> Result<()>
Starts collecting JavaScript coverage.
Must be called before navigating to the page(s) you want to measure.
§Errors
Returns error if coverage is already started, if the browser is not Chromium, or if the RPC call fails.
See: https://playwright.dev/docs/api/class-coverage#coverage-start-js-coverage
Sourcepub async fn stop_js_coverage(&self) -> Result<Vec<JSCoverageEntry>>
pub async fn stop_js_coverage(&self) -> Result<Vec<JSCoverageEntry>>
Stops JavaScript coverage collection and returns the entries.
§Errors
Returns error if coverage was not started or if the RPC call fails.
See: https://playwright.dev/docs/api/class-coverage#coverage-stop-js-coverage
Sourcepub async fn start_css_coverage(
&self,
options: Option<StartCSSCoverageOptions>,
) -> Result<()>
pub async fn start_css_coverage( &self, options: Option<StartCSSCoverageOptions>, ) -> Result<()>
Starts collecting CSS coverage.
§Errors
Returns error if coverage is already started, if the browser is not Chromium, or if the RPC call fails.
See: https://playwright.dev/docs/api/class-coverage#coverage-start-css-coverage
Sourcepub async fn stop_css_coverage(&self) -> Result<Vec<CSSCoverageEntry>>
pub async fn stop_css_coverage(&self) -> Result<Vec<CSSCoverageEntry>>
Stops CSS coverage collection and returns the entries.
§Errors
Returns error if coverage was not started or if the RPC call fails.
See: https://playwright.dev/docs/api/class-coverage#coverage-stop-css-coverage