Skip to content

Commit

Permalink
fixes #80 - support new WebDriver spec element ID
Browse files Browse the repository at this point in the history
  • Loading branch information
robocoder committed Sep 25, 2019
1 parent bd94050 commit 7e179d5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/WebDriver/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
*/
abstract class Container extends AbstractWebDriver
{
const LEGACY_ELEMENT_ID = 'ELEMENT';
const WEBDRIVER_ELEMENT_ID = 'element-6066-11e4-a52e-4f735466cecf';

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -203,12 +206,19 @@ public function locate($using, $value)
*/
protected function webDriverElement($value)
{
return array_key_exists('ELEMENT', (array) $value)
? new Element(
$this->getElementPath($value['ELEMENT']), // url
$value['ELEMENT'] // id
)
: null;
if (array_key_exists(self::LEGACY_ELEMENT_ID, (array) $value)) {
return new Element(
$this->getElementPath($value[self::LEGACY_ELEMENT_ID]), // url
$value[self::LEGACY_ELEMENT_ID] // id
);
}

if (array_key_exists(self::WEBDRIVER_ELEMENT_ID, (array) $value)) {
return new Element(
$this->getElementPath($value[self::WEBDRIVER_ELEMENT_ID]), // url
$value[self::WEBDRIVER_ELEMENT_ID] // id
);
}
}

/**
Expand Down

0 comments on commit 7e179d5

Please sign in to comment.