Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/javascript/selenium-webdriver/test/ie/options_test.js
2885 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 ie = require('selenium-webdriver/ie')
22
const test = require('../../lib/test')
23
const Capabilities = require('selenium-webdriver/lib/capabilities').Capabilities
24
25
test.suite(
26
function (env) {
27
let driver
28
29
describe('Internet Explorer options', function () {
30
it('can set fileUploadDialogTimeout', async function () {
31
let timeOut = 10000
32
let options = new ie.Options().fileUploadDialogTimeout(timeOut)
33
34
driver = await env.builder().setIeOptions(options).build()
35
36
let caps = await driver.getCapabilities()
37
caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ie.Key.FILE_UPLOAD_DIALOG_TIMEOUT]
38
assert.strictEqual(caps, timeOut)
39
await driver.quit()
40
})
41
42
it('can set browserAttachTimeout', async function () {
43
let timeOut = 10000
44
let options = new ie.Options().browserAttachTimeout(timeOut)
45
46
driver = await env.builder().setIeOptions(options).build()
47
48
let caps = await driver.getCapabilities()
49
caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ie.Key.BROWSER_ATTACH_TIMEOUT]
50
assert.strictEqual(caps, timeOut)
51
await driver.quit()
52
})
53
54
it('can set elementScrollBehaviour - TOP', async function () {
55
let options = new ie.Options().setScrollBehavior(ie.Behavior.TOP)
56
driver = await env.builder().setIeOptions(options).build()
57
58
let caps = await driver.getCapabilities()
59
caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ie.Key.ELEMENT_SCROLL_BEHAVIOR]
60
assert.strictEqual(caps, ie.Behavior.TOP)
61
await driver.quit()
62
})
63
64
it('can set elementScrollBehaviour - BOTTOM', async function () {
65
let options = new ie.Options().setScrollBehavior(ie.Behavior.TOP)
66
driver = await env.builder().setIeOptions(options).build()
67
68
let caps = await driver.getCapabilities()
69
caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ie.Key.ELEMENT_SCROLL_BEHAVIOR]
70
assert.strictEqual(caps, ie.Behavior.TOP)
71
await driver.quit()
72
})
73
74
it('can set multiple browser-command-line switches', async function () {
75
let options = new ie.Options()
76
options.addBrowserCommandSwitches('-k')
77
options.addBrowserCommandSwitches('-private')
78
options.forceCreateProcessApi(true)
79
driver = await env.builder().setIeOptions(options).build()
80
81
let caps = await driver.getCapabilities()
82
caps = caps.map_.get(ie.VENDOR_COMMAND_PREFIX)[ie.Key.BROWSER_COMMAND_LINE_SWITCHES]
83
assert.strictEqual(caps, '-k -private')
84
await driver.quit()
85
})
86
87
it('can set capability', async function () {
88
let caps = Capabilities.ie()
89
assert.ok(!caps.has('silent'))
90
assert.strictEqual(undefined, caps.get('silent'))
91
caps.set('silent', true)
92
assert.strictEqual(true, caps.get('silent'))
93
assert.ok(caps.has('silent'))
94
})
95
})
96
},
97
{ browsers: ['internet explorer'] },
98
)
99
100