tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

chrome.py (902B)


      1 import pytest
      2 from support.context import using_context
      3 from tests.support.asserts import assert_error, assert_success
      4 
      5 from . import switch_to_window
      6 
      7 
      8 @pytest.mark.allow_system_access
      9 def test_no_such_window(session):
     10    with using_context(session, "chrome"):
     11        response = switch_to_window(session, "foo")
     12        assert_error(response, "no such window")
     13 
     14 
     15 @pytest.mark.allow_system_access
     16 def test_chrome_window(session):
     17    session.new_window(type_hint="window")
     18 
     19    with using_context(session, "chrome"):
     20        current_handle = session.window_handle
     21        chrome_handles = session.handles
     22 
     23        chrome_handles.remove(current_handle)
     24 
     25        assert len(chrome_handles)
     26 
     27        response = switch_to_window(session, chrome_handles[0])
     28        assert_success(response)
     29 
     30        assert session.window_handle == chrome_handles[0]
     31        assert session.window_handle != current_handle