Skip to content

Commit

Permalink
Fixed use of deprecated CDP API methods (MontFerret#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex authored Jul 17, 2021
1 parent 1d64cb5 commit 53bcfc9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/drivers/cdp/input/quad.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ func getClickablePoint(ctx context.Context, client *cdp.Client, qargs *dom.GetCo
return Quad{}, err
}

clientWidth := layoutMetricsReply.LayoutViewport.ClientWidth
clientHeight := layoutMetricsReply.LayoutViewport.ClientHeight
clientWidth := layoutMetricsReply.CSSLayoutViewport.ClientWidth
clientHeight := layoutMetricsReply.CSSLayoutViewport.ClientHeight

quads := make([][]Quad, 0, len(contentQuadsReply.Quads))

Expand Down
4 changes: 2 additions & 2 deletions pkg/drivers/cdp/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,11 @@ func (p *HTMLPage) CaptureScreenshot(ctx context.Context, params drivers.Screens
}

if params.Width <= 0 {
params.Width = values.Float(metrics.LayoutViewport.ClientWidth) - params.X
params.Width = values.Float(metrics.CSSLayoutViewport.ClientWidth) - params.X
}

if params.Height <= 0 {
params.Height = values.Float(metrics.LayoutViewport.ClientHeight) - params.Y
params.Height = values.Float(metrics.CSSLayoutViewport.ClientHeight) - params.Y
}

clip := page.Viewport{
Expand Down

0 comments on commit 53bcfc9

Please sign in to comment.