Question:
I want to make a screenshot of the site using PhantomJS. I found the rasterize.js script in the examples that came with it, but I don’t understand with what parameters to run it in order to get the required screenshot size.
You need to make a jpg picture with a size of 400x300px, with screenshots of the site, and only one screen, i.e. if the page is long and scrolls down, then you do not need to screen the entire page, but only what fits on one screen 1900 * 600pc
Answer:
{
"id": "sanity_tests",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 3294
},
{
"label": "tablet",
"width": 768,
"height": 3294
},
{
"label": "desktop",
"width": 1280,
"height": 3294
}
],
"scenarios": [
{
"label": "home_page",
"url": "https://some-page.com/",
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": "",
"selectors": [
"body"
],
"delay": 4000,
"misMatchThreshold": 0.1
},
{
"label": "contacts",
"url": "https://some-page.com/contacts",
"hideSelectors": [],
"removeSelectors": [],
"hoverSelector": "",
"selectors": [
"body"
],
"delay": 4000,
"misMatchThreshold": 0.1
}
],
"paths": {
"bitmaps_reference": "backstopjs_tests/dev_reference",
"bitmaps_test": "backstopjs_tests/dev_test",
"html_report": "backstopjs_tests/dev_html_report",
"ci_report": "backstopjs_tests/dev_ci_report"
},
"casperFlags": [
"--ignore-ssl-errors=true",
"--ssl-protocol=any"
],
"report": ["CLI", "browser"],
"engine": "phantomjs",
"cliExitOnFail": false,
"debug": false
}
And in the dimensions to the device indicate the dimensions you need