Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/py/test/unit/selenium/webdriver/webkitgtk/webkitgtk_options_tests.py
1990 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
import pytest
19
20
from selenium.webdriver.common.options import PageLoadStrategy
21
from selenium.webdriver.webkitgtk.options import Options
22
23
24
@pytest.fixture
25
def options():
26
return Options()
27
28
29
def test_set_binary_location(options):
30
options.binary_location = "/foo/bar"
31
assert options._binary_location == "/foo/bar"
32
33
34
def test_get_binary_location(options):
35
options._binary_location = "/foo/bar"
36
assert options.binary_location == "/foo/bar"
37
38
39
def test_set_overlay_scrollbars_enabled(options):
40
options.overlay_scrollbars_enabled = False
41
assert options._overlay_scrollbars_enabled is False
42
43
44
def test_get_overlay_scrollbars_enabled(options):
45
options._overlay_scrollbars_enabled = True
46
assert options.overlay_scrollbars_enabled is True
47
48
49
def test_creates_capabilities(options):
50
options._arguments = ["foo"]
51
options._binary_location = "/bar"
52
options._overlay_scrollbars_enabled = True
53
caps = options.to_capabilities()
54
opts = caps.get(Options.KEY)
55
assert opts
56
assert "foo" in opts["args"]
57
assert opts["binary"] == "/bar"
58
assert opts["useOverlayScrollbars"] is True
59
60
61
def test_starts_with_default_capabilities(options):
62
from selenium.webdriver import DesiredCapabilities
63
64
caps = DesiredCapabilities.WEBKITGTK.copy()
65
caps.update({"pageLoadStrategy": PageLoadStrategy.normal})
66
assert options._caps == caps
67
68
69
def test_is_a_baseoptions(options):
70
from selenium.webdriver.common.options import BaseOptions
71
72
assert isinstance(options, BaseOptions)
73
74