JSFiddle - React, Tailwind, and code Playground
JavaScript
var casper = require('casper').create({
pageSettings: {
// 冒充浏览器
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53'
},
// 浏览器窗口大小
viewportSize: {
width: 320,
height: 568
}
});
phantom.addCookie({
name: 'BDUSS',
value: '你复制的cookie',
domain: '.baidu.com',
path: '/',
secure: false,
httponly: false,
expires: Date.now() + (1000 * 60 * 60 * 24 * 5)
});
casper.start();
casper.thenOpen('http://www.baidu.com/', function () {
casper.captureSelector('baidu.png', 'html');
});
casper.run();