3

我正在研究 phantomjs 示例,但TypeError: Attempting to change the setter of an unconfigurable property。 错误不断出现。我想将返回的值通过管道传输到文件,但即使使用下面的简单示例,它们也充满了这些错误消息。

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();

});

产生:

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

它应该发回Bing任何解决方法吗?

我在 Ubuntu 18.04 64 位上使用 PhantomJS 2.1.1。

4

0 回答 0