Closed soygul closed 8 years ago
Alternative is to use this python script: https://github.com/ponty/pyscreenshot
Or call platform specific screenshot utility. On OS X:
from subprocess import call
call(["screencapture", "screenshot.jpg”])
This works from inside the electron-app:
// app.js
const screenshot = require('electron-screenshot');
function takeScreenshot(path) {
screenshot({'filename': path});
}
# test.py
self.driver.execute_script("takeScreenshot(\'" + filepath + "\');")
Closing this as won't fix as it is an upstream vendor issue. Should be solved at Electron level if possible.
http://selenium-python.readthedocs.org/faq.html#how-to-take-screenshot-of-the-current-window
Issue discussed here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=816
Looks like the solution is to make the Electron browser to navigate or refresh page at least once.