diff --git a/src/Extensions/Selenium.php b/src/Extensions/Selenium.php index de23294..9836fae 100644 --- a/src/Extensions/Selenium.php +++ b/src/Extensions/Selenium.php @@ -148,7 +148,7 @@ protected function findByValue($value, $element = 'input') return $this->session->element('css selector', "{$element}[value='{$value}']"); } catch (NoSuchElement $e) { try { - return $this->session->element('xpath', "//button[contains(text(),'Register')]"); + return $this->session->element('xpath', "//button[contains(text(),'{$value}')]"); } catch (NoSuchElement $e) { throw new InvalidArgumentException( "Crap. Couldn't find an {$element} with a 'value' attribute of '{$value}'. We also looked " .