Hi Jean,

I am not sure you can get direct object definition of WebClient into Grovvy.
Actually WebClient is written in java and it has a built in Grovvy jar that
let you handel the grove script.

If you look at the following slide show from the WebClients home page. it
will show you how to create your own first WebTest project.

This project will include a grovvy code for a simple click event on the
google website. You can simple modify that project for your own site.

After you get  started with the project you use the Step Index link below to
create new steps in your script (click buttons, click links, verify text,
ext...).



Slide Show:
http://opensource.basehaus.com/webtest/screencasts/creating-a-first-webtest-project.htm

Web Test Home Page: http://webtest.canoo.com/webtest/manual/WebTestHome.html

Step Index: http://webtest.canoo.com/webtest/manual/stepIndex.html





On Tue, Jun 2, 2009 at 12:26 PM, Jean Hominal <[email protected]> wrote:

> Hello all,
>
> I have begun using Canoo Webtest to define some Unit tests for a web
> application that uses the SmartClient framework.
>
> After some trial and error, it appears that the only "good" way to
> programmatically click a button for a SmartClient application is to:
> 1. Know the button's ID for SmartClient (for example, foo)
> 2. Call "foo.click()" in JavaScript, in the page's context.
>
> I would like to be able to click a button this way through as simple a
> series of steps as possible, in Groovy.
>
> So, it boils down to:
>  * How can I, from a webtest written in Groovy, get a reference to the
> instance of com.gargoylesoftware.htmlunit.WebClient in use?
>  * How can I tell WebClient to run a given String as JavaScript?
>
> I realize that these questions are not very hard, however:
>  * Though I am quite familiar with Java, the writing of these tests is
> my very first try at Groovy; and, as I have not been able to find a
> source file for the com/canoo/webtest/WebtestCase.class from which my
> tests inherit, I do not quite know where or how to search for the
> relevant information.
>  * I already have a lead for the second question with the
> WebClient.getJavaScriptEngine() method, but I would like to know if
> anyone would know of a "cleaner", better documented way.
>
> Thank you in advance for your help,
> --
> Jean Hominal
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest
>



-- 
__________________________
Vihang Desai
Test Engineer (U.S. Citizen)

Reply via email to