Skip to content

Commit 8655988

Browse files
committed
fix: dpr issue with takeElementScreenshot in web
1 parent 986fcfa commit 8655988

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/webdriver-image-comparison/src/commands/saveWebElement.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export default async function saveWebElement(
9090
isIOS,
9191
isLandscape,
9292
// When the element needs to be resized, we need to take a screenshot of the whole page
93-
fallback: !!saveElementOptions.method.resizeDimensions || false,
93+
// or when devicePixelRatio is different than 1 as the browser takeElementScreenshot does not consider DPR
94+
fallback: (!!devicePixelRatio && devicePixelRatio > 1) || !!saveElementOptions.method.resizeDimensions || false,
9495
screenShot,
9596
takeElementScreenshot,
9697
})

0 commit comments

Comments
 (0)