Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This project versioning adheres to [Semantic Versioning](http://semver.org/).

---

### Fixed
- Mozilla firefox geckodriver fix. ([PHPUnit\Framework\Exception] Undefined index: ELEMENT)

## 1.6.0 - 2018-05-16
### Added
- Connection and request timeouts could be specified also when creating RemoteWebDriver from existing session ID.
Expand Down
8 changes: 6 additions & 2 deletions lib/Remote/RemoteWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ public function findElement(WebDriverBy $by)
$params
);

return $this->newElement($raw_element['ELEMENT']);
return $this->newElement(
isset($raw_element['ELEMENT']) ? $raw_element['ELEMENT'] : $raw_element[\key($raw_element)]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, you can create a separate function. In order not to violate DRY

private function _getElement($raw_element) {
    return isset($raw_element['ELEMENT']) ? 
        $raw_element['ELEMENT'] : $raw_element[\key($raw_element)];
}

);
}

/**
Expand All @@ -207,7 +209,9 @@ public function findElements(WebDriverBy $by)

$elements = [];
foreach ($raw_elements as $raw_element) {
$elements[] = $this->newElement($raw_element['ELEMENT']);
$elements[] = $this->newElement(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$elements[] = $this->newElement($this->_getElement($raw_element));

isset($raw_element['ELEMENT']) ? $raw_element['ELEMENT'] : $raw_element[\key($raw_element)]
);
}

return $elements;
Expand Down