Skip to content

Commit be87042

Browse files
committed
fixes #80 - support new WebDriver spec element ID
1 parent 6fa9594 commit be87042

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/WebDriver/Container.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
*/
3333
abstract class Container extends AbstractWebDriver
3434
{
35+
const LEGACY_ELEMENT_ID = 'ELEMENT';
36+
const WEBDRIVER_ELEMENT_ID = 'element-6066-11e4-a52e-4f735466cecf';
37+
3538
/**
3639
* {@inheritdoc}
3740
*/
@@ -203,12 +206,19 @@ public function locate($using, $value)
203206
*/
204207
protected function webDriverElement($value)
205208
{
206-
return array_key_exists('ELEMENT', (array) $value)
207-
? new Element(
208-
$this->getElementPath($value['ELEMENT']), // url
209-
$value['ELEMENT'] // id
210-
)
211-
: null;
209+
if (array_key_exists(self::LEGACY_ELEMENT_ID, (array) $value)) {
210+
return new Element(
211+
$this->getElementPath($value[self::LEGACY_ELEMENT_ID]), // url
212+
$value[self::LEGACY_ELEMENT_ID] // id
213+
);
214+
}
215+
216+
if (array_key_exists(self::WEBDRIVER_ELEMENT_ID, (array) $value)) {
217+
return new Element(
218+
$this->getElementPath($value[self::WEBDRIVER_ELEMENT_ID]), // url
219+
$value[self::WEBDRIVER_ELEMENT_ID] // id
220+
);
221+
}
212222
}
213223

214224
/**

0 commit comments

Comments
 (0)