No, Groovy is the same. Maybe I did not understand your problem
clearly.
Let me re-phase my question.

After

 type "file", path

an exception was generated because of invalid file type. In your test
case,
It went to the next statement

String text = getAlert()

or went to

println(e.printStackTrace())

in the catch block?

If it went to getAlert(), what did you get back?

On Mar 26, 10:24 pm, Harihara Vinayakaram <[email protected]> wrote:
> My function looks like this:
>  click "phrframe.Upload"
>     try {
>       type "file", path
>       //refresh();
>       //pause 3000
>       String text = getAlert()
>       println("Text of the alert is " + text)
>       return false
>     }
>     catch (Exception e) {
>        println(e.printStackTrace())
>       return true
>     }
>
> My code is in groovy (if that makes any difference).  The exception is
> thrown after the type command
>
> Regards
> Hari
>
> On Thu, Mar 26, 2009 at 9:37 PM, John <[email protected]> wrote:
>
> > Hi Hari,
>
> > The capture screen shot logic is as follows,
>
> >        try {
> >            return sc.client.metaClass.invokeMethod(sc.client, name,
> > args)
> >        } catch (Exception e) {
> >            if (this.captureScreenshot) {
> >                long timestamp = System.currentTimeMillis()
> >                String filename = filenamePattern.replaceFirst
> > (PLACE_HOLDER, "${timestamp}")
> >                sc.client.captureScreenshot(filename)
> >                println "Screenshot for exception <<" + e.getMessage()
> > + ">> is saved to file ${filename}"
> >            }
> >            throw e
> >        }
>
> > As you see, it will re-throw the exception e. I think your code should
> > be able to capture the exception and go to the catch block
> > unless something wired happened. Could you put some code snippet here?
>
> > Thanks,
>
> > Jian
>
> > On Mar 26, 9:58 am, Harihara Vinayakaram <[email protected]> wrote:
> > > Hi
> > >   My test case is failing with an error that says
> > >  Screenshot for exception <<ERROR: There was an unexpected Alert!
> > [Invalid
> > > file type , Please select a proper file]>> is saved to file
> > > Screenshot1238075685112.png
>
> > > My test code that executes is present within a try {  ....  }  catch
> > > (Exception e) {   }   block . But this does not come with the catch
> > block.
> > > How do I catch these kind of errors
>
> > > Thanks
> > > Regards
> > > Hari
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tellurium-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tellurium-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to