From b686c5fe74ae4f3d5f7ff6e45234d99562de9ff4 Mon Sep 17 00:00:00 2001 From: alexpott Date: Wed, 17 Jul 2024 16:21:54 +0100 Subject: [PATCH] Add close command for a window (#14) --- lib/WebDriver/LegacyWindow.php | 12 ++++++++++++ lib/WebDriver/Window.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/WebDriver/LegacyWindow.php b/lib/WebDriver/LegacyWindow.php index e641b9e..7c06049 100644 --- a/lib/WebDriver/LegacyWindow.php +++ b/lib/WebDriver/LegacyWindow.php @@ -82,4 +82,16 @@ public function getHandle() return $this->windowHandle; } + + /** + * Close window: /session/:sessionId/window (DELETE) + * + * @return mixed + */ + public function close() + { + $result = $this->curl('DELETE', ''); + + return $result['value']; + } } diff --git a/lib/WebDriver/Window.php b/lib/WebDriver/Window.php index b6d95a8..56e77f4 100644 --- a/lib/WebDriver/Window.php +++ b/lib/WebDriver/Window.php @@ -93,4 +93,16 @@ public function getHandle() return $this->windowHandle; } + + /** + * Close window: /session/:sessionId/window (DELETE) + * + * @return mixed + */ + public function close() + { + $result = $this->curl('DELETE', ''); + + return $result['value']; + } }