NB : Maybe you have to catch something else than an exception, like Error,
I'm not sure.

On Fri, Jul 24, 2009 at 9:47 AM, Fran coyy <franc...@gmail.com> wrote:

> You should try :
>
> try {
> assertElementPresentByXPath("//d...@id='bob']"));
>   ////perform actions
>
> }
> catch(Exception e) {
>  //this corresponds to your "else" statement
>
> }
>
>
> Good luck,
> François
>
>
> On Thu, Jul 23, 2009 at 10:30 PM, Stand Trooper <standtroo...@gmail.com>wrote:
>
>> Ok, so I've been toying with this for a day or so without revelation, so
>> I'm hoping that I can find the answer here.  I've searched the cryptic
>> archives and read javadocs and even played with a lot of different things.
>>
>> What I need to do is find out if an element is present before I move on.
>>
>> for example:
>> if (elementExists("//d...@id='bob']")) {
>> //perform action
>> }
>>
>> or even an override to getElement that passes a boolean to not do the
>> assertion, if the element doesn't exist it returns a null object.
>>
>> Right now, I have a series of interactions on forms that may cause errors
>> that I'm testing, if an error displays, then an element will show up on the
>> page.  I'm doing about 295,000 automated tests right now and I'll be bumping
>> that up to about 895k tests once these are done.  I can't just do an
>> assertTextPresent or assertTextNotPresent, I need to detect if something is
>> there, if it is, then perform a specific action and move on without taking
>> down the tests and having to start over.
>>
>> Is there anything like that that I can use?  If not, that's ok, I'll have
>> to write some code, unless someone has something quick in mind.
>>
>> thx
>>
>> timo
>> StandTrooper
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> JWebUnit-users mailing list
>> JWebUnit-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>
>>
>
------------------------------------------------------------------------------
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to