|
| 1 | +// Copyright 2015 Selenium committers |
| 2 | +// Copyright 2015 Software Freedom Conservancy |
| 3 | +// |
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +// you may not use this file except in compliance with the License. |
| 6 | +// You may obtain a copy of the License at |
| 7 | +// |
| 8 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +// |
| 10 | +// Unless required by applicable law or agreed to in writing, software |
| 11 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +// See the License for the specific language governing permissions and |
| 14 | +// limitations under the License. |
| 15 | + |
| 16 | +'use strict'; |
| 17 | + |
| 18 | +var assert = require('../testing/assert'), |
| 19 | + test = require('../lib/test'), |
| 20 | + Pages = test.Pages; |
| 21 | + |
| 22 | + |
| 23 | +test.suite(function(env) { |
| 24 | + var browsers = env.browsers; |
| 25 | + |
| 26 | + var driver; |
| 27 | + test.before(function() { |
| 28 | + driver = env.builder().build(); |
| 29 | + }); |
| 30 | + |
| 31 | + test.after(function() { |
| 32 | + driver.quit(); |
| 33 | + }); |
| 34 | + |
| 35 | + describe('fingerprinting', function() { |
| 36 | + test.it('it should fingerprint the navigator object', function() { |
| 37 | + driver.get(Pages.simpleTestPage); |
| 38 | + assert(driver.executeScript('return navigator.webdriver')).equalTo(true); |
| 39 | + }); |
| 40 | + |
| 41 | + test.it('fingerprint must not be writable', function() { |
| 42 | + driver.get(Pages.simpleTestPage); |
| 43 | + assert(driver.executeScript( |
| 44 | + 'navigator.webdriver = "ohai"; return navigator.webdriver')) |
| 45 | + .equalTo(true); |
| 46 | + }); |
| 47 | + |
| 48 | + test.it('leaves fingerprint on svg pages', function() { |
| 49 | + driver.get(Pages.svgPage); |
| 50 | + assert(driver.executeScript('return navigator.webdriver')).equalTo(true); |
| 51 | + }); |
| 52 | + }); |
| 53 | + |
| 54 | +// Currently only implemented in firefox. |
| 55 | +}, {browsers: ['firefox']}); |
0 commit comments