Responsive website screenshot with Pageres with URLs from a text file - phantomjs

I am trying to use pageres(https://github.com/sindresorhus/pageres) module to take screenshots of my website in different resolutions.
It works fine when I provide the URL and the size in command line but it doesn't work when I have my urls in a text file. It takes a screenshot of only the last URL in the file. I use the following command to run pageres:
pageres 640x768 < urls.txt
URLs in the text file are newline separated so they look like this:
http://www.yahoo.com
http://www.msn.com
http://www.apple.com
So it basically takes a screenshot of only apple.com and throws the error below for each of the screenshot above it.
The error I get is:
TypeError: 'undefined' is not an object <evaluating 'options.windowSize.width'>
and the file it points to is webshot.phantom.js line 13.
Am I running the command incorrectly or something? I use it the way it is mentioned on their site.
Thank you for your help.

It might have been a bug at some point, but it works fine in the latest version. Just tested.

Related

Typo3 LTS9 PDF dimensions are not read and displayed in 0x0

I am having an issue with PDF's in the latest Typo3 release. If I add PDF to the Image content element, I get this:
The file info looks like this:
Checking the Image Processing Test of Typo3, no errors are returned. PDF/AI also seems to be fine.
I tested several PDF's and AI files as well, they won't show dimensions either.
I have the suspicion that the command 'identify' does not work within Typo3, it still returns perfect results from shell.
Any idea where to look?
multiple reasons possible:
you just need to reimport metadata (scheduler task)
your PDF is coded in an unsual format (there is more then one option in PDF to include the title image)
missing/wrong rights:
maybe another program is executed from commandline than from PHP.
maybe the file can't be accessed correctly from ghostscript started from web

Unable to embed a screenshot to the SpecFlow html Report

I am executing my automation scenarios using SpecFlow with Visual Studio.
I want to Embed a custom image to the HTML report which was generated by SpecFlow. That image is a screenshot i am taking whenever scenario is failed in Hooks.
Please help me out.
This is what i am seeing in the html report - enter image description here
Take a look at the SeleniumWebTest sample project here. This sample project shows how to include a screenshot in your report. While the example is Selenium-based, the same principles apply to other frameworks.
A more in-depth explanation of how this works can be found here under "Including Screenshots". Essentially, you need to abuse the console and use it to output your images' file paths.
Any data written to the console is available in your report (this is how the trace details are received by the report). You will need to parse the data written to the console and strip out the file path you want to embed. Make sure that you strip the image path completely so that you don't output the file path as part of the other trace information received from the console.
Edit: I've since discovered that there seems to be an issue with the template in the sample project. The following section in the template is bugged:
class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ <a href="http://specflow.org/plus/documentation/,-/" data-page=",-"<img width='1000' src=").Replace("</a> ]SCREENSHOT", "</img>"))</pre>
This is because the console no longer seems to be formatting the file as a hyperlink, so the replacement string is never found. Updating this line in ReportTemplate.cshtml seems to have done the trick:
<pre class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ ", "<img width='1000' src=\"").Replace(" ]SCREENSHOT", "\"</img>"))</pre>
As the console is no longer formatting the file as a hyperlink, you only need to replace the padding (in this case the "SCREENSHOT[]SCREENSHOT") from the string and instead enclose the path with the <IMG> tag. You also need to add the quotes around the file path.

Phantomjs is duplicating content when exporting to PDF

I've encountered a weird issue with Phantomjs when converting an html file to pdf. My html, resulting pdf, and rasterize.js files are below:
http://401web.com/_pub/2TRTI8E.html
http://401web.com/_pub/2TRTI8E.pdf
http://401web.com/_pub/rasterize.js
You will notice that in the PDF file, at page 6, the content gets cut off and then on page 7, the content is repeated and is then correct all the way to the end of the document.
The html file contains a series of tags with their src attributes set as data:image/png;base64...
The application call to the phantom library is as follows:
phantomJS.Run("C:\path\to\directory\rasterize.js"),
new[] { webpath, outFilePdf, "A4", "1", "portrait"}, null, null);
Note that sometimes the rendered pdf file will exhibit the break/repeat behavior in different locations within the document eg: page 7 instead of 6) but the same issue always occurs.
Also, I am using phantomjs throughout my application (with the same rasterize.js script) with no other issues. This only happens on this export and only if there are a number of images.
My theory is that there is something going on with the image.onload event, specifically with base64 data but I have no idea how to troubleshoot this.
This is all within a .Net MVC application. I am using the PhantomJS nuget package found here: https://www.nuget.org/packages/PhantomJS/
Help is greatly appreciated.
Update: when running phantomjs locally via command line I was receiving the error below:
[CRITICAL] QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written
libpng error: Read Error
I solved this (though I have no idea how/why) by replacing the cdn references in the html file to font-awesome.css and weather-icons.css files with locally hosted versions. After that, no more error and no more duplicate content.

when I load .off file in CGAL Polyhedron demo, nothing were showed in the window

enter image description here
I have build the demo succesfully, and runs the demo, but when I try to load .off file, it comes out nothing. In the console window, the error message " QWindowsNativeFieDialogBase::shellitem:SHCreateItemFromParsingName(file:debug)failed(no such file or direcory)"
Could somebody give me any instruction?
It seams the problem is similar to this one : [http://cgal-discuss.949826.n4.nabble.com/Problem-with-loading-off-files-in-Polyhedron-demo-td4661212.html][1]
Do you build any plugin ? You need at least off_plugin to load an off file in addition of Polyhedron_3

video.js.map throwing a 404 (Not Found)

Playing around with the newest video.js today, I'm noticing that video.js.map is showing up as a 404 when putting the video.js script into a site that I'm working on.
I don't see a source map file in the initial distribution, but it doesn't throw this error locally, only when I put it on a server.
Ideas as to solving?
You have a few options when you don't have access to a source map:
Ignore the message. It generaly only gets thrown when your dev tools are open.
Remove the reference in the original file. These are the last characters (comments) at the end of the file.
Generate a source map yourself when you have access to the source code. For video.js, it can be generated from video.dev.js.
Use a public CDN version which might not link to the source map.
There also is a discussion on GitHub about this topic.
I get the same error, everything should still work though. I think it's an html5 or browser bug
I was seeing this as well, but only in my log files. I was getting three multi-line entries (failures) every time a video was played in my production.log in a RoR site. It was really bulking up my .log file. More info on #smhg's 2nd bullet (remove references). I'm using video.js 5.4.6 along with some vpad-vast plugin stuff - I could see all three files referenced in my .log file. Your mileage may vary.
Edit video.js and remove the following entry on line 19694:
//# sourceMappingURL=video.js.map
(for vpaid-vast plugin only...)
Edit videojs_5.vast.vpaid.min.js and remove this line from the very end:
//# sourceMappingURL=videojs_5.vast.vpaid.min.js.map
Edit videojs.vast.vpaid.min.css and remove this line from the very end:
/*# sourceMappingURL=videojs.vast.vpaid.min.css.map */
The entries are no longer appearing in my log file and the player works fine.
Hope it helps!