Merge pull request #1079 from andy-g/fetchText_handle_form_elements
refs #1078 - Handle form elements in fetchText (waitForSelectorTextChange)
Showing
2 changed files
with
10 additions
and
1 deletions
... | @@ -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à</body></html>'); | 23 | this.setContent('<html><body>Voilà</body></html>'); | ... | ... |
-
Please register or sign in to post a comment