puppeteer/third_party/phantomjs/test/module/webpage/user-agent.js
2017-05-11 00:06:41 -07:00

23 lines
603 B
JavaScript

var webpage = require('webpage');
async_test(function () {
var ua = 'PHANTOMJS-TEST-USER-AGENT';
var page = webpage.create({
settings: {
userAgent: ua
}
});
assert_equals(page.settings.userAgent, ua);
page.open(TEST_HTTP_BASE + 'user-agent.html',
this.step_func_done(function (status) {
assert_equals(status, 'success');
var agent = page.evaluate(function() {
return document.getElementById('ua').textContent;
});
assert_equals(agent, ua);
}));
}, "load a page with a custom user agent");