File tree Expand file tree Collapse file tree 3 files changed +40
-4
lines changed
Expand file tree Collapse file tree 3 files changed +40
-4
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 1+ <!doctype html>
2+ <html >
3+ <head ><title ></title ></head >
4+ <body >
5+ <form >
6+ <label for = " title-1" >Title</label >
7+ <input id = " title-1" >
8+
9+ <div class = " nested" >
10+ <label for = " title-2" >Title</label >
11+ <input id = " title-2" >
12+ </div >
13+ </form >
14+ </body >
15+ </html >
Original file line number Diff line number Diff line change 44
55use Codeception \Module \WebDriver ;
66use Codeception \Test \Unit ;
7+ use Codeception \Util \ActionSequence ;
78
89/**
910 * Author: davert
@@ -1745,4 +1746,24 @@ public function testPasswordArgument()
17451746 $ data = data::get ('form ' );
17461747 $ this ->assertEquals ('thisissecret ' , $ data ['password ' ]);
17471748 }
1749+
1750+ /**
1751+ * @see https://github.com/Codeception/module-webdriver/issues/79
1752+ */
1753+ public function testFieldActionsWithPerformOn ()
1754+ {
1755+ $ this ->module ->amOnPage ('/form/bug79 ' );
1756+ $ this ->module ->performOn (
1757+ ['class ' => 'nested ' ],
1758+ ActionSequence::build ()->fillField ('Title ' , 'Test ' )
1759+ );
1760+
1761+ $ this ->module ->dontSeeInField ('#title-1 ' , 'Test ' );
1762+ $ this ->module ->seeInField ('#title-2 ' , 'Test ' );
1763+
1764+ $ title1Value = $ this ->module ->grabValueFrom ('#title-1 ' );
1765+ $ this ->assertEmpty ($ title1Value );
1766+ $ title2Value = $ this ->module ->grabValueFrom ('#title-2 ' );
1767+ $ this ->assertEquals ('Test ' , $ title2Value );
1768+ }
17481769}
You can’t perform that action at this time.
0 commit comments