mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
23 lines
603 B
JavaScript
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");
|