我尝试使用此代码模拟使用phantomjs单击,但不起作用:
var page = require('webpage').create
( { viewportSize:
{
width: 1600,height: 900
},
settings:
{
userAgent:'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
javascriptEnabled:'true',
loadImages:'false'
}
}
);
var fs = require('fs');
console.log('Console-1');
page.onLoadStarted = function()
{
loadInProgress = true;
console.log('Console-2');
};
page.onLoadFinished = function()
{
loadInProgress = false;
console.log('Console-3');
};
page.onConsoleMessage = function(msg)
{
console.log(msg);
};
page.open("https://plus.google.com/share?url=http://www.example.com", function(status)
{ page.evaluate(function(){ page.sendEvent('click',350,33,button='left');});
setTimeout(5000);
});
我可以看到我的错误,我不知道这是否可能,我需要任何提示继续......