Check if element exists on a page

65 views
Skip to first unread message

mada

unread,
Sep 19, 2010, 1:34:29 PM9/19/10
to FuncUnit
Hi,

What is the best way of checking if an html element exists or not on a
page?

Thanks.

Justin Meyer

unread,
Sep 19, 2010, 1:46:38 PM9/19/10
to func...@googlegroups.com
S('selector').exists()

Sent from my iPhone

mada

unread,
Sep 19, 2010, 2:09:23 PM9/19/10
to FuncUnit
I tried to use exists() or visible() but doesn't really help me. This
functions wait until the element exists or is visible, but if this
never happens, the test fails.
I need something like:
if (element exists)
// do something
else
//do something else
It is possible to implement something similar with this using
funcunit?

On Sep 19, 1:46 pm, Justin Meyer <justinbme...@gmail.com> wrote:
> S('selector').exists()
>
> Sent from my iPhone
>

Justin Meyer

unread,
Sep 19, 2010, 4:23:44 PM9/19/10
to func...@googlegroups.com
 S(selector).count()

if count returns 0, it's not on the page.


Justin Meyer

Jupiter Consulting
\Development\Training\Support
847-924-6039
justin...@gmail.com
Reply all
Reply to author
Forward
0 new messages