Path: blob/trunk/py/test/unit/selenium/webdriver/edge/edge_options_tests.py
1990 views
# Licensed to the Software Freedom Conservancy (SFC) under one1# or more contributor license agreements. See the NOTICE file2# distributed with this work for additional information3# regarding copyright ownership. The SFC licenses this file4# to you under the Apache License, Version 2.0 (the5# "License"); you may not use this file except in compliance6# with the License. You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing,11# software distributed under the License is distributed on an12# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13# KIND, either express or implied. See the License for the14# specific language governing permissions and limitations15# under the License.1617import pytest1819from selenium.webdriver.common.options import PageLoadStrategy20from selenium.webdriver.edge.options import Options212223@pytest.fixture24def options():25return Options()262728def test_raises_exception_with_invalid_page_load_strategy(options):29with pytest.raises(ValueError):30options.page_load_strategy = "never"313233def test_set_page_load_strategy(options):34options.page_load_strategy = PageLoadStrategy.normal35caps = options.to_capabilities()36assert caps["pageLoadStrategy"] == PageLoadStrategy.normal373839def test_get_page_load_strategy(options):40options._caps["pageLoadStrategy"] = PageLoadStrategy.normal41assert options.page_load_strategy == PageLoadStrategy.normal424344def test_creates_capabilities(options):45options.page_load_strategy = PageLoadStrategy.eager46caps = options.to_capabilities()47assert caps["pageLoadStrategy"] == PageLoadStrategy.eager484950def test_starts_with_default_capabilities(options):51from selenium.webdriver import DesiredCapabilities5253caps = DesiredCapabilities.EDGE.copy()54caps.update({"pageLoadStrategy": PageLoadStrategy.normal})55assert options._caps == caps565758def test_is_a_baseoptions(options):59from selenium.webdriver.common.options import BaseOptions6061assert isinstance(options, BaseOptions)626364def test_use_webview():65options = Options()66options.use_webview = True67caps = options.to_capabilities()68assert caps["browserName"] == "webview2"697071