mirror of https://github.com/vitalif/phantomjs
parent
9c7753189f
commit
b36da277e9
|
@ -0,0 +1,20 @@
|
|||
var assert = require('../../assert');
|
||||
var webpage = require('webpage');
|
||||
|
||||
|
||||
var ua = 'PHANTOMJS-TEST-USER-AGENT';
|
||||
var page = webpage.create({
|
||||
settings: {
|
||||
userAgent: ua
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(page.settings.userAgent, ua);
|
||||
|
||||
page.open('http://localhost:9180/user-agent.html', function (status) {
|
||||
assert.equal(status, 'success');
|
||||
var agent = page.evaluate(function() {
|
||||
return document.getElementById('ua').textContent;
|
||||
});
|
||||
assert.equal(agent, ua);
|
||||
});
|
|
@ -1290,18 +1290,6 @@ describe("WebPage construction with options", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("specifying userAgent", function () {
|
||||
var opts = {
|
||||
settings: {
|
||||
userAgent: "PHANTOMJS-TEST-USER-AGENT"
|
||||
}
|
||||
};
|
||||
var page = new WebPage(opts);
|
||||
it("should have userAgent as '"+opts.settings.userAgent+"'",function () {
|
||||
expect(page.settings.userAgent).toEqual(opts.settings.userAgent);
|
||||
});
|
||||
});
|
||||
|
||||
describe("specifying viewportSize", function () {
|
||||
var opts = {
|
||||
viewportSize: {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>User Agent</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>User agent is: <span id="ua">Unknown</span>.</p>
|
||||
<script>document.getElementById('ua').textContent = navigator.userAgent</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue