Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/py/test/selenium/webdriver/common/bidi_session_tests.py
1865 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.window import WindowTypes
21
22
23
@pytest.mark.xfail_safari
24
def test_session_status(driver):
25
result = driver._session.status()
26
assert result is not None
27
assert "ready" in result
28
assert "message" in result
29
assert isinstance(result["ready"], bool)
30
assert isinstance(result["message"], str)
31
32
33
@pytest.mark.xfail_safari
34
def test_session_status_not_closed_with_one_window(driver):
35
# initial session status
36
initial_status = driver._session.status()
37
assert initial_status is not None
38
39
# Open new window and tab
40
driver.switch_to.new_window(WindowTypes.WINDOW)
41
driver.switch_to.new_window(WindowTypes.TAB)
42
43
# Close one window
44
driver.close()
45
46
# Session should still be active
47
status_after_closing = driver._session.status()
48
assert status_after_closing is not None
49
assert "ready" in status_after_closing
50
assert "message" in status_after_closing
51
52