Weird TypeError when running a simple script to take a screenshot

464 views
Skip to first unread message

Giacomo Alzetta

unread,
Oct 27, 2018, 5:01:14 PM10/27/18
to phantomjs
Hi, I'm trying to write a very simple script to take a screenshot. This script is called repeatedly by an other python script and quite often it raises the error:

TypeError: Attempting to change the setter of an unconfigurable property.

The whole script is:

"use strict";
var webpage = require('webpage'),
    system = require('system'),
    address = system.args[1],
    file = system.args[2];

var page = webpage.create();

page.open(address,  function (status) {
    setTimeout(function () {
        var exitCode = 0;
        if (status !== 'success') {
            exitCode = 1;
        } else {
            page.render(file);
        }
        phantom.exit(exitCode);
    }, parseInt(system.args[3]));
});

I'm not setting anything at all so I don't understand where the error comes from.

However in that case the script is written in python and uses the heimdal library to create the screenshots via PhantomJS.

Is this a known bug of PhantomJS so that randomly it fails in that way? Maybe it's the same issue as: https://github.com/ariya/phantomjs/issues/15360 ?

Note: as far as I can tell all the screenshots are being saved, so it's just annoying to have that error message. The StackOverflow question linked above stated that sometimes the screenshots wouldn't be saved, so if there is a known solution I'd rather go with that instead of just hiding the error message.
Reply all
Reply to author
Forward
0 new messages