Skip to content

Commit 3922cf0

Browse files
committed
Respect base element with fillField()/seeInField()/dontSeeInField()
Fixes #79
1 parent 085c554 commit 3922cf0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ protected function findFields($selector): array
12551255
}
12561256

12571257
if (is_array($selector) || ($selector instanceof WebDriverBy)) {
1258-
$fields = $this->match($this->webDriver, $selector);
1258+
$fields = $this->match($this->getBaseElement(), $selector);
12591259

12601260
if (empty($fields)) {
12611261
throw new ElementNotFound($selector);
@@ -1272,20 +1272,20 @@ protected function findFields($selector): array
12721272
".//label[contains(normalize-space(string(.)), {$locator})]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')]"
12731273
// @codingStandardsIgnoreEnd
12741274
);
1275-
$fields = $this->webDriver->findElements(WebDriverBy::xpath($xpath));
1275+
$fields = $this->getBaseElement()->findElements(WebDriverBy::xpath($xpath));
12761276
if (!empty($fields)) {
12771277
return $fields;
12781278
}
12791279

12801280
// by name
12811281
$xpath = ".//*[self::input | self::textarea | self::select][@name = {$locator}]";
1282-
$fields = $this->webDriver->findElements(WebDriverBy::xpath($xpath));
1282+
$fields = $this->getBaseElement()->findElements(WebDriverBy::xpath($xpath));
12831283
if (!empty($fields)) {
12841284
return $fields;
12851285
}
12861286

12871287
// try to match by CSS or XPath
1288-
$fields = $this->match($this->webDriver, $selector, false);
1288+
$fields = $this->match($this->getBaseElement(), $selector, false);
12891289
if (!empty($fields)) {
12901290
return $fields;
12911291
}

0 commit comments

Comments
 (0)