File tree Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -1255,7 +1255,7 @@ protected function findFields($selector): array
1255
1255
}
1256
1256
1257
1257
if (is_array ($ selector ) || ($ selector instanceof WebDriverBy)) {
1258
- $ fields = $ this ->match ($ this ->webDriver , $ selector );
1258
+ $ fields = $ this ->match ($ this ->getBaseElement () , $ selector );
1259
1259
1260
1260
if (empty ($ fields )) {
1261
1261
throw new ElementNotFound ($ selector );
@@ -1272,20 +1272,20 @@ protected function findFields($selector): array
1272
1272
".//label[contains(normalize-space(string(.)), {$ locator })]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')] "
1273
1273
// @codingStandardsIgnoreEnd
1274
1274
);
1275
- $ fields = $ this ->webDriver ->findElements (WebDriverBy::xpath ($ xpath ));
1275
+ $ fields = $ this ->getBaseElement () ->findElements (WebDriverBy::xpath ($ xpath ));
1276
1276
if (!empty ($ fields )) {
1277
1277
return $ fields ;
1278
1278
}
1279
1279
1280
1280
// by name
1281
1281
$ 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 ));
1283
1283
if (!empty ($ fields )) {
1284
1284
return $ fields ;
1285
1285
}
1286
1286
1287
1287
// try to match by CSS or XPath
1288
- $ fields = $ this ->match ($ this ->webDriver , $ selector , false );
1288
+ $ fields = $ this ->match ($ this ->getBaseElement () , $ selector , false );
1289
1289
if (!empty ($ fields )) {
1290
1290
return $ fields ;
1291
1291
}
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 4
4
5
5
use Codeception \Module \WebDriver ;
6
6
use Codeception \Test \Unit ;
7
+ use Codeception \Util \ActionSequence ;
7
8
8
9
/**
9
10
* Author: davert
@@ -1745,4 +1746,27 @@ public function testPasswordArgument()
1745
1746
$ data = data::get ('form ' );
1746
1747
$ this ->assertEquals ('thisissecret ' , $ data ['password ' ]);
1747
1748
}
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 ()
1759
+ ->fillField ('Title ' , 'Test ' )
1760
+ ->seeInField ('Title ' , 'Test ' )
1761
+ );
1762
+
1763
+ $ this ->module ->dontSeeInField ('Title ' , 'Test ' );
1764
+ $ this ->module ->dontSeeInField ('#title-1 ' , 'Test ' );
1765
+ $ this ->module ->seeInField ('#title-2 ' , 'Test ' );
1766
+
1767
+ $ title1Value = $ this ->module ->grabValueFrom ('#title-1 ' );
1768
+ $ this ->assertEmpty ($ title1Value );
1769
+ $ title2Value = $ this ->module ->grabValueFrom ('#title-2 ' );
1770
+ $ this ->assertEquals ('Test ' , $ title2Value );
1771
+ }
1748
1772
}
You can’t perform that action at this time.
0 commit comments