跳到正文
本页尚未翻译成中文,以下为英文原文。 查看英文版

PlaywrightException ​

Added in: v1.10

Extends: RuntimeException

  • extends: [RuntimeException]

PlaywrightException is thrown whenever certain operations are terminated abnormally, e.g. browser closes while Page.EvaluateAsync() is running.

csharp
try
{
    await page.EvaluateAsync("() => new Promise(() => {})");
}
catch (PlaywrightException e)
{
    // When the page closes during the call, the exception message says so.
    Console.WriteLine(e.Message);
}

基于 Apache 2.0 许可证发布。