OLD | NEW |
(Empty) | |
| 1 # generate\_screenshots.py |
| 2 |
| 3 The generate\_screenshots.py script is a utility to create a screenshot of the |
| 4 same UI element across all 50+ language into which Chrome is translated. |
| 5 It has been written to generate screenshots for the privacy whitepaper but you |
| 6 may feel free to add more screenshots for other cases (e.g. help center |
| 7 articles). |
| 8 |
| 9 The script supports two kinds of screenshots: |
| 10 * Screenshots of web content (e.g. chrome://settings pages). |
| 11 For this kind of screenshot, HTML elements can be addressed by CSS selectors |
| 12 and captured. |
| 13 * Screenshots of pixels (e.g. for the omnibar). |
| 14 For this kind of screenshot, a Chrome window is positioned at the top left |
| 15 of the desktop and set to a window size of 800x600 pixels. |
| 16 |
| 17 ## Dependencies |
| 18 |
| 19 Install pyautogui: |
| 20 sudo apt-get install python-Xlib pip scrot |
| 21 sudo pip install pyautogui |
| 22 |
| 23 ## Executing generate\_screenshots.py |
| 24 |
| 25 # Expand PYTHONPATH |
| 26 export PYTHONPATH="$PYTHONPATH:$CHROMESRC/third\_party/webdriver/pylib" |
| 27 |
| 28 # Execute generator |
| 29 python generate\_screenshots.py \ |
| 30 --chrome-path /usr/bin/google-chrome-beta \ |
| 31 --chromedriver-path $CHROMESRC/out/Debug/chromedriver \ |
| 32 --safebrowsing-path ~/.config/google-chrome-beta/ \ |
| 33 --profile-path /tmp/temp-profile \ |
| 34 -v \ |
| 35 --screenshots uma \ |
| 36 --languages en \ |
| 37 --output-path /tmp/screenshots |
| 38 |
| 39 The parameters are as follows: |
| 40 * `--chrome-path`: The path to the Chrome binary to execute. |
| 41 * `--chromedriver-path`: The path to the Chrome driver binary. Compile it |
| 42 yourself or download it from |
| 43 [here](https://sites.google.com/a/chromium.org/chromedriver/) |
| 44 * `--safebrowsing-path`: A path to an existing Chrome profile. This allows |
| 45 the screenshot generator to copy the current safebrowsing database and |
| 46 use it for safebrowsing related screenshots. Chrome downloades them |
| 47 lazily after up to 10 minutes and we don't want to wait that long. |
| 48 * `--profile-path`: A directory that will be deleted before each execution |
| 49 and used to host a user profile. |
| 50 * `--v`: Enable debug output. |
| 51 * `--screenshots`: A list of screenshots to create. If this parameter is not |
| 52 passed, all known screenshots are generated. |
| 53 * `--languages`: A list of languages for which screenshots should be |
| 54 generated. If this is not passed, screenshots are generated for all known |
| 55 languages. |
| 56 * `--output-path`: Directory in which screenshots are written. |
| 57 |
| 58 ## Dealing with enterprise policies. |
| 59 |
| 60 Some screenshots may contain UI elements that are controlled by corporate |
| 61 policies. On Linux your enterprise policies may be stored at |
| 62 `/etc/opt/chrome/policies/managed`. You may want to delete them before creating |
| 63 screenshots. |
OLD | NEW |