checking if element is present

26 views
Skip to first unread message

littlegeek

unread,
Aug 12, 2009, 6:02:27 PM8/12/09
to webdriver
Is the only way to check if an element is present on the page to put
it in a try/catch block? Selenium has a 'isElementPresent' method.
Is there anything similar to that in WebDriver?

Simon Stewart

unread,
Aug 13, 2009, 4:04:28 AM8/13/09
to webd...@googlegroups.com
Yes, the only way to check is with a try/catch block (or, I suppose
"findElements" and checking to see if the returned list has no
elements in it)

The reason for this behaviour is that when I originally wrote
WebDriver, there really weren't many AJAX apps around, so not finding
an element was normally a Bad Thing. At some point, I'll be adding
implicit waits for elements, which should make things a little neater.

Regards,

Simon

Danny Leblond

unread,
Aug 13, 2009, 9:30:34 AM8/13/09
to webd...@googlegroups.com
IF you go back some pages to a thread called IE 7 problems, theres a Zip attached that does a wait for element, I think is more what your looking for. A good temporary solution until there is better AJAX support.
Danny
Reply all
Reply to author
Forward
0 new messages