Commit ab8f3ded ab8f3ded3a30919165869e9d2a3ab85e571916f9 by Mickaël Andrieu

Merge pull request #1079 from andy-g/fetchText_handle_form_elements

refs #1078 - Handle form elements in fetchText (waitForSelectorTextChange)
2 parents df30390d c165386b
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
230 var text = '', elements = this.findAll(selector); 230 var text = '', elements = this.findAll(selector);
231 if (elements && elements.length) { 231 if (elements && elements.length) {
232 Array.prototype.forEach.call(elements, function _forEach(element) { 232 Array.prototype.forEach.call(elements, function _forEach(element) {
233 text += element.textContent || element.innerText; 233 text += element.textContent || element.innerText || element.value;
234 }); 234 });
235 } 235 }
236 return text; 236 return text;
......
...@@ -9,6 +9,15 @@ casper.test.begin('fetchText() basic tests', 1, function(test) { ...@@ -9,6 +9,15 @@ casper.test.begin('fetchText() basic tests', 1, function(test) {
9 }); 9 });
10 }); 10 });
11 11
12 casper.test.begin('fetchText() basic tests', 1, function(test) {
13 casper.start('tests/site/index.html', function() {
14 test.assertEquals(this.fetchText('input[name="dummy_name"]'), 'dummy_value',
15 'Casper.fetchText() can retrieve text contents from an input element');
16 }).run(function() {
17 test.done();
18 });
19 });
20
12 casper.test.begin('fetchText() handles HTML entities', 1, function(test) { 21 casper.test.begin('fetchText() handles HTML entities', 1, function(test) {
13 casper.start().then(function() { 22 casper.start().then(function() {
14 this.setContent('<html><body>Voil&agrave;</body></html>'); 23 this.setContent('<html><body>Voil&agrave;</body></html>');
......