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
057c2a04
...
057c2a04ef4f616ec19800431f3dc0f4c35d633e
authored
2011-10-08 17:58:22 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added documentation for Casper#fill()
1 parent
1d73e498
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
README.md
README.md
View file @
057c2a0
...
...
@@ -424,6 +424,32 @@ casper.start('http://www.google.fr/', function(self) {
});
```
### Casper#fill(String selector, Object values)
Fills the fields of a form with given values.
Example:
```
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'
,
});
self
.
click
(
'input[type=submit]'
);
}).
then
(
function
(
self
)
{
self
.
evaluateOrDie
(
function
()
{
return
/message sent/
.
test
(
document
.
body
.
innerText
);
},
'sending message failed'
);
}).
run
(
function
(
self
)
{
self
.
echo
(
'message sent'
).
exit
();
});
```
**WARNING:**
Please don't use Casper nor PhantomJS to send spam, or I call the Chuck.
### Casper#repeat(int times, function then)
Repeats a navigation step a given number of times.
...
...
Please
register
or
sign in
to post a comment