Skip to content

Commit 8ca6d7e

Browse files
committed
Fixes #138, closes #139 - fix the b0rked lazy init of windowHandle
1 parent 06c9b52 commit 8ca6d7e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/WebDriver/LegacyWindow.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ public function __construct($url, $windowHandle = null)
6262
{
6363
parent::__construct($url);
6464

65+
if (! $windowHandle || $windowHandle === 'current') {
66+
$result = $this->curl('GET', '_handle');
67+
68+
$windowHandle = $result['value'];
69+
}
70+
6571
$this->windowHandle = $windowHandle;
72+
73+
$this->url .= '/' . $windowHandle;
6674
}
6775

6876
/**
@@ -74,12 +82,6 @@ public function __construct($url, $windowHandle = null)
7482
*/
7583
public function getHandle()
7684
{
77-
if (! $this->windowHandle) {
78-
$result = $this->curl('GET', '_handle');
79-
80-
$this->windowHandle = $result['value'];
81-
}
82-
8385
return $this->windowHandle;
8486
}
8587
}

0 commit comments

Comments
 (0)