Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
casperjs
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
edfade4b
...
edfade4bc285a13c47f2f389001fb231db6e2e9b
authored
2013-02-14 19:16:25 +0100
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
better form submission in fill() by using events
1 parent
1cd41d0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
modules/casper.js
modules/casper.js
View file @
edfade4
...
...
@@ -740,6 +740,12 @@ Casper.prototype.fill = function fill(selector, vals, submit) {
var
method
=
(
form
.
getAttribute
(
'method'
)
||
"GET"
).
toUpperCase
();
var
action
=
form
.
getAttribute
(
'action'
)
||
"unknown"
;
__utils__
.
log
(
'submitting form to '
+
action
+
', HTTP '
+
method
,
'info'
);
var
event
=
document
.
createEvent
(
'Event'
);
event
.
initEvent
(
'submit'
,
true
,
true
);
if
(
!
form
.
dispatchEvent
(
event
))
{
__utils__
.
log
(
'unable to submit form'
,
'warning'
);
return
;
}
if
(
typeof
form
.
submit
===
"function"
)
{
form
.
submit
();
}
else
{
...
...
Please
register
or
sign in
to post a comment