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
3622f3e2
...
3622f3e238fa92a3da882b4e10dd6d48230a5987
authored
2011-10-10 12:43:10 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
better documentation for Casper#fill
1 parent
b962f381
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
README.md
README.md
View file @
3622f3e
...
...
@@ -372,15 +372,32 @@ casper.start('http://www.google.fr/', function(self) {
Fills the fields of a form with given values and optionnaly submit it.
Example:
Example with this sample html form:
```
html
<form
action=
"/contact"
id=
"contact-form"
enctype=
"multipart/form-data"
>
<input
type=
"text"
name=
"subject"
/>
<textearea
name=
"content"
></textearea>
<input
type=
"radio"
name=
"civility"
value=
"Mr"
/>
Mr
<input
type=
"radio"
name=
"civility"
value=
"Mrs"
/>
Mrs
<input
type=
"text"
name=
"name"
/>
<input
type=
"email"
name=
"email"
/>
<input
type=
"file"
name=
"attachment"
/>
<input
type=
"checkbox"
name=
"cc"
/>
Receive a copy
<input
type=
"submit"
/>
</form>
```
```
javascript
casper
.
start
(
'http://some.tld/contact.form'
,
function
(
self
)
{
self
.
fill
(
'form#contact-form'
,
{
'subject'
:
'I am watching you'
,
'content'
:
'So be careful.'
,
'name'
:
'Chuck Norris'
,
'email'
:
'chuck@norris.com'
,
'subject'
:
'I am watching you'
,
'content'
:
'So be careful.'
,
'civility'
:
'Mr'
,
'name'
:
'Chuck Norris'
,
'email'
:
'chuck@norris.com'
,
'cc'
:
true
,
'attachment'
:
'/Users/chuck/roundhousekick.doc'
},
true
);
}).
then
(
function
(
self
)
{
self
.
evaluateOrDie
(
function
()
{
...
...
Please
register
or
sign in
to post a comment