diff --git a/src/Codeception/Module/WebDriver.php b/src/Codeception/Module/WebDriver.php index 01a742a3..69354aed 100644 --- a/src/Codeception/Module/WebDriver.php +++ b/src/Codeception/Module/WebDriver.php @@ -1255,7 +1255,7 @@ protected function findFields($selector): array } if (is_array($selector) || ($selector instanceof WebDriverBy)) { - $fields = $this->match($this->webDriver, $selector); + $fields = $this->match($this->getBaseElement(), $selector); if (empty($fields)) { throw new ElementNotFound($selector); @@ -1272,20 +1272,20 @@ protected function findFields($selector): array ".//label[contains(normalize-space(string(.)), {$locator})]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]" // @codingStandardsIgnoreEnd ); - $fields = $this->webDriver->findElements(WebDriverBy::xpath($xpath)); + $fields = $this->getBaseElement()->findElements(WebDriverBy::xpath($xpath)); if (!empty($fields)) { return $fields; } // by name $xpath = ".//*[self::input | self::textarea | self::select][@name = {$locator}]"; - $fields = $this->webDriver->findElements(WebDriverBy::xpath($xpath)); + $fields = $this->getBaseElement()->findElements(WebDriverBy::xpath($xpath)); if (!empty($fields)) { return $fields; } // try to match by CSS or XPath - $fields = $this->match($this->webDriver, $selector, false); + $fields = $this->match($this->getBaseElement(), $selector, false); if (!empty($fields)) { return $fields; } diff --git a/tests/data/app/view/form/bug79.php b/tests/data/app/view/form/bug79.php new file mode 100644 index 00000000..902f783e --- /dev/null +++ b/tests/data/app/view/form/bug79.php @@ -0,0 +1,15 @@ + + +