/** * @throws Exception If element not found, rather than fatal'ing (method call on non-obj) * @author Ronan Chilvers <*****@*****.**> */ public function apply(Connection $connection) { $formSelector = $this->formSelector; // Apply test entries foreach ($this->textEntries as $selector => $text) { $selector = "{$formSelector} {$selector}"; $element = $connection->getElement($selector); if (!$element instanceof WebDriverElement) { throw new Exception('Unable to find Element by selector: ' . $selector); } $element->clear(); $element->sendKeys($text); } foreach ($this->selectEntries as $selector => $option) { $selector = "{$selector} option[value='{$option}']"; $element = $connection->getElement($selector); if (!$element instanceof WebDriverElement) { throw new Exception('Unable to find Element by selector: ' . $selector); } $element->click(); } }