mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1652973 - [wdspec] Move close() method of webdriver client into the Window class. r=jgraham
Differential Revision: https://phabricator.services.mozilla.com/D83799
This commit is contained in:
parent
d87d25b173
commit
e5d59335ce
@ -242,6 +242,15 @@ class Window(object):
|
||||
def __init__(self, session):
|
||||
self.session = session
|
||||
|
||||
@command
|
||||
def close(self):
|
||||
handles = self.session.send_session_command("DELETE", "window")
|
||||
if handles is not None and len(handles) == 0:
|
||||
# With no more open top-level browsing contexts, the session is closed.
|
||||
self.session.session_id = None
|
||||
|
||||
return handles
|
||||
|
||||
@property
|
||||
@command
|
||||
def rect(self):
|
||||
@ -569,15 +578,6 @@ class Session(object):
|
||||
|
||||
return self.send_session_command("POST", url, body)
|
||||
|
||||
@command
|
||||
def close(self):
|
||||
handles = self.send_session_command("DELETE", "window")
|
||||
if handles is not None and len(handles) == 0:
|
||||
# With no more open top-level browsing contexts, the session is closed.
|
||||
self.session_id = None
|
||||
|
||||
return handles
|
||||
|
||||
@property
|
||||
@command
|
||||
def handles(self):
|
||||
|
@ -12,7 +12,7 @@ def fixture_session(capabilities, session, create_window):
|
||||
yield session
|
||||
|
||||
try:
|
||||
session.close()
|
||||
session.window.close()
|
||||
except NoSuchWindowException:
|
||||
pass
|
||||
|
||||
|
@ -12,7 +12,7 @@ def fixture_session(capabilities, session, create_window):
|
||||
yield session
|
||||
|
||||
try:
|
||||
session.close()
|
||||
session.window.close()
|
||||
except NoSuchWindowException:
|
||||
pass
|
||||
|
||||
|
@ -11,7 +11,7 @@ def test_no_browsing_context(session, create_window):
|
||||
|
||||
new_handle = create_window()
|
||||
session.window_handle = new_handle
|
||||
session.close()
|
||||
session.window.close()
|
||||
|
||||
response = get_window_handles(session)
|
||||
assert_success(response, window_handles)
|
||||
|
@ -17,7 +17,7 @@ def fixture_session(capabilities, session, create_window):
|
||||
pass
|
||||
|
||||
try:
|
||||
session.close()
|
||||
session.window.close()
|
||||
except NoSuchWindowException:
|
||||
pass
|
||||
|
||||
|
@ -230,7 +230,7 @@ def closed_window(session, create_window):
|
||||
new_handle = create_window()
|
||||
session.window_handle = new_handle
|
||||
|
||||
session.close()
|
||||
session.window.close()
|
||||
assert new_handle not in session.handles, "Unable to close window {}".format(new_handle)
|
||||
|
||||
yield new_handle
|
||||
|
@ -70,7 +70,7 @@ def cleanup_session(session):
|
||||
for window in _windows(session, exclude=[current_window]):
|
||||
session.window_handle = window
|
||||
if len(session.handles) > 1:
|
||||
session.close()
|
||||
session.window.close()
|
||||
|
||||
session.window_handle = current_window
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user