fixed #117 - fill() cant submit a form with a submit input named "submit"
Showing
2 changed files
with
8 additions
and
3 deletions
... | @@ -531,7 +531,12 @@ Casper.prototype.fill = function fill(selector, vals, submit) { | ... | @@ -531,7 +531,12 @@ Casper.prototype.fill = function fill(selector, vals, submit) { |
531 | var method = (form.getAttribute('method') || "GET").toUpperCase(); | 531 | var method = (form.getAttribute('method') || "GET").toUpperCase(); |
532 | var action = form.getAttribute('action') || "unknown"; | 532 | var action = form.getAttribute('action') || "unknown"; |
533 | __utils__.log('submitting form to ' + action + ', HTTP ' + method, 'info'); | 533 | __utils__.log('submitting form to ' + action + ', HTTP ' + method, 'info'); |
534 | form.submit(); | 534 | if (typeof form.submit === "function") { |
535 | form.submit(); | ||
536 | } else { | ||
537 | // http://www.spiration.co.uk/post/1232/Submit-is-not-a-function | ||
538 | form.submit.click(); | ||
539 | } | ||
535 | }, { selector: selector }); | 540 | }, { selector: selector }); |
536 | } | 541 | } |
537 | }; | 542 | }; | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | <input type="checkbox" name="checklist[]" value="1" /> | 19 | <input type="checkbox" name="checklist[]" value="1" /> |
20 | <input type="checkbox" name="checklist[]" value="2" /> | 20 | <input type="checkbox" name="checklist[]" value="2" /> |
21 | <input type="checkbox" name="checklist[]" value="3" /> | 21 | <input type="checkbox" name="checklist[]" value="3" /> |
22 | <input type="submit"/> | 22 | <input type="submit" name="submit" value="submit" /> |
23 | </form> | 23 | </form> |
24 | </body> | 24 | </body> |
25 | </html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
25 | </html> | ... | ... |
-
Please register or sign in to post a comment