5

I'm working my way through the phantomjs examples but TypeError: Attempting to change the setter of an unconfigurable property. errors keep popping up. I wanted to pipe returned values to files but they are full of these error messages even with the simple examples see below.

var webPage = require('webpage');
var page = webPage.create();

page.settings.userAgent = 'Mozilla/5.0 (Linux; Android 9; SM-G960F Build/PPR1.180610.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.157 Mobile Safari/537.36';


page.open('http://m.bing.com', function(status) {

  var title = page.evaluate(function() {
    return document.title;
  });

  console.log(title);
  phantom.exit();

});

Produces:

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

It should send back just Bing any workarounds?

I'm using PhantomJS 2.1.1 on Ubuntu 18.04 64bit.

Rick T
  • 3,349
  • 10
  • 54
  • 119
  • 6
    I got the same error as you using the simple example displayed on https://phantomjs.org/. The issue happened when using the Ubuntu package of PhantomJS but I was able to to fix it by downloading the latest version on https://phantomjs.org/download.html. Note that PhantomJS is not maintained anymore so it recommended to use an alternative tool like Selenium WebDriver. – baptx Sep 12 '20 at 14:06

1 Answers1

0

As baptx stated there is a problem with ubuntu package, install it directly from the official source.

However it didn't solve my problem, I got an error with libssl_conf.so. The way I solved it was:

export OPENSSL_CONF=/dev/null
kosciej16
  • 6,294
  • 1
  • 18
  • 29