Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/javascript/selenium-webdriver/test/firefox/full_page_screenshot_test.js
1864 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
'use strict'
19
20
const assert = require('node:assert')
21
const { Browser } = require('selenium-webdriver/index')
22
const { Pages, suite } = require('../../lib/test')
23
let startIndex = 0
24
let endIndex = 5
25
let pngMagicNumber = 'iVBOR'
26
suite(
27
function (env) {
28
describe('firefox', function () {
29
let driver
30
31
beforeEach(function () {
32
driver = null
33
})
34
35
afterEach(function () {
36
return driver && driver.quit()
37
})
38
39
it('Should be able to take full page screenshot', async function () {
40
driver = env.builder().build()
41
await driver.get(Pages.simpleTestPage)
42
let encoding = await driver.takeFullPageScreenshot()
43
const base64code = encoding.slice(startIndex, endIndex)
44
assert.equal(base64code, pngMagicNumber)
45
})
46
})
47
},
48
{ browsers: [Browser.FIREFOX] },
49
)
50
51