-
Notifications
You must be signed in to change notification settings - Fork 164
FAQ
Thomas D edited this page Nov 11, 2020
·
28 revisions
Look at this first: https://github.com/maaaaz/webscreenshot/wiki/How-to-debug-errors
-
Q
: webscreenshot does not work with certain or all HTTPS Websites (gettingQSslSocket: cannot call unresolved function SSLv23_client_method
errors or similar with--debug true
) -
A
: You are probably using an old version of PhantomJS, update it to the latest version of the branch 2.X. Up to the version 2.0, PhantomJS does only support SSLv2, SSLv3 and TLSv1.0 protocols (nor TLSv1.1 neither TLSv1.2), the Web server you are trying to screenshot might only offer TLSv1.1 and TLSv1.2.
-
Q
: I'm running an headless OS and executingphantomjs
in a shell returns"QXcbConnection: Could not connect to display"
-
A
: Install thexvfb
dependency (apt-get install xvfb
etc.) and use the webscreenshot--no-xserver
option, which is wrapper aroundxvfb-run
(cf. that issue). From version 2.92, webscreenshot will try to detect if running on an headless OS or not, and apply automatically--no-xserver
-
Q
: I want to call webscreenshot from inside another Python script -
A
:webscreenshot
is not yet coded as a Python lib but you can try the following code in Python 2 or 3 (originally from that issue but the base code evolved). You can, of course, adapt each option to your purpose.
Note that this method currently does not work when using Python 3.8+ on Windows
import argparse
from webscreenshot.webscreenshot import *
# url list to screenshot
url_list = ['http://google.fr', 'http://google.com']
# defining options manually
options = argparse.Namespace(URL=None, ajax_max_timeouts='1400,1800', cookie=None, crop=None, custom_js=None, format='png', header=None, http_password=None, http_username=None, imagemagick_binary=None, input_file=None, label=False, label_bg_color='NavajoWhite', label_size=60, log_level='DEBUG', multiprotocol=False, no_error_file=False, no_xserver=False, output_directory='/tmp/screenshots', port=None, proxy=None, proxy_auth=None, proxy_type=None, quality=75, renderer='phantomjs', renderer_binary=None, single_output_file=None, ssl=False, timeout=30, verbosity=2, window_size='1200,800', workers=4)
# actually launching the function
take_screenshot(url_list, options)
Webscreenshot currently does not support paths containing whitespaces (for instance in the current working directory, or renderer binary path cf. https://github.com/maaaaz/webscreenshot/issues/48)
-
Q
: Screenshots are taken before the page is totally loaded -
A
: It is possible to address this issue by playing with the--ajax-max-timeout
option, currently only supported by thephantomjs
renderer
-
Q
: The--window-size
parameter does not seem to work, or does not work for my current renderer -
A
: Yes, it is known bug forphantomjs
, take a look at this issue to find an alternative withImageMagick
This is currently supported, only for the phantomjs
renderer, with the --custom-js
option (cf. https://github.com/maaaaz/webscreenshot/issues/34)