Skip to content

Commit 9e01a86

Browse files
ondrejbartasMifrill
authored andcommitted
Screenshot PNGs with transparent background
1 parent d4c744c commit 9e01a86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ browser.screenshot(path: "google.png") # => 134660
344344
browser.screenshot(path: "google.jpg") # => 30902
345345
# Save to Base64 the whole page not only viewport and reduce quality
346346
browser.screenshot(full: true, quality: 60) # "iVBORw0KGgoAAAANSUhEUgAABAAAAAMACAYAAAC6uhUNAAAAAXNSR0IArs4c6Q...
347+
348+
# To have transparent background for PNGs run before screenshotting
349+
browser.command('Emulation.setDefaultBackgroundColorOverride', color: { r: 0, g: 0, b: 0, a: 0 })
350+
# To restore background run
351+
browser.command('Emulation.setDefaultBackgroundColorOverride')
347352
```
348353

349354
#### pdf(\*\*options) : `String` | `Integer`

0 commit comments

Comments
 (0)