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
39d5b661
...
39d5b661f31616ff663bf4ab17d86484bfce0cec
authored
2011-10-14 09:06:07 +0200
by
Nicolas Perriault
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
added Casper#exists() method to check for a DOM element
1 parent
0e6b9a67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
casper.js
tests/assert.js
casper.js
View file @
39d5b66
...
...
@@ -306,6 +306,20 @@
},
/**
* Checks if an element matching the provided CSS3 selector exists in
* current page DOM.
*
* @return Boolean
*/
exists
:
function
(
selector
)
{
return
self
.
evaluate
(
function
()
{
return
__utils__
.
exists
(
'%selector%'
);
},
{
selector
:
selector
});
};
/**
* Fills a form with provided field values.
*
* @param String selector A CSS3 selector to the target form to fill
...
...
tests/assert.js
View file @
39d5b66
...
...
@@ -41,6 +41,10 @@ phantom.Casper.extend({
return
this
.
assert
(
pattern
.
test
(
subject
),
message
);
},
assertSelectorExists
:
function
(
selector
,
message
)
{
return
this
.
assert
(
this
.
exists
(
selector
),
message
);
},
assertTitle
:
function
(
expected
,
message
)
{
return
this
.
assertEvalEquals
(
function
()
{
return
document
.
title
;
...
...
Please
register
or
sign in
to post a comment