ReadInnerHTMLAsBody option

This commit is contained in:
Haiping Chen 2024-10-07 20:20:48 -05:00
parent 7033ec2484
commit 468f84981c
2 changed files with 8 additions and 2 deletions

View file

@ -43,4 +43,6 @@ public class PageActionArgs
/// Wait time in seconds after page is opened
/// </summary>
public int WaitTime { get; set; }
public bool ReadInnerHTMLAsBody { get; set; } = false;
}

View file

@ -67,9 +67,13 @@ public partial class PlaywrightWebDriver
result.ResponseStatusCode = response.Status;
if (response.Status == 200)
{
// Disable this due to performance issue, some page is too large
// result.Body = await page.InnerHTMLAsync("body");
result.IsSuccess = true;
// Be careful if page is too large, it will cause performance issue
if (args.ReadInnerHTMLAsBody)
{
result.Body = await page.InnerHTMLAsync("body");
}
}
else
{