paulhammond / webkit2png

png screenshots of webpages

Home Page:http://www.paulhammond.org/webkit2png/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

passing in user agent string is broken

christianaoh opened this issue · comments

Passing in a --user-agent arg produces a blank screenshot with text An unexpected error has occurred. Running the same command without user agent works fine. I am trying to screenshot a page that has conditional rendering logic based on user agent.

ss_mobile-full

(Below urls have been redacted for privacy reasons)
This works:
webkit2png "<exampleurl>" -D "./Desktop" -o "ss_mobile" -W 375 -H 667 -F --clipwidth 1"

This doesn't:
webkit2png "<exampleurl>" -D "./Desktop" -o "ss_mobile" -W 375 -H 667 -F --clipwidth 1 --user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Mobile/15E148 Safari/604.1"

The above also outputs a Python warning:

2021-10-26 13:19:50.978 Python[14178:106238] *** WARNING: Method convertPointToBase: in class NSView is deprecated on 10.7 and later. It should not be used in new applications.