Re: Executing dynamic DSL command

2018-01-17 Thread Mohan Radhakrishnan
;{->" + script + "}"); cl.setDelegate(context); cl.setResolveStrategy(Closure.DELEGATE_FIRST); return cl.call(); } Thanks, Mohan On 16 January 2018 at 19:35, Mohan Radhakrishnan < radhakrishnan.mo...@gmail.com> wrote: > I mean that this works if the DSL com

Re: Executing dynamic DSL command

2018-01-16 Thread Mohan Radhakrishnan
nuary 2018 at 19:06, Mohan Radhakrishnan < radhakrishnan.mo...@gmail.com> wrote: > Hi, > > I am reading the book 'Groovy in Action' and this code is based on > that. > > My base script stores 'DynamicXPath' like this. > > abstract class AxesBaseScript exte

Executing dynamic DSL command

2018-01-16 Thread Mohan Radhakrishnan
Hi, I am reading the book 'Groovy in Action' and this code is based on that. My base script stores 'DynamicXPath' like this. abstract class AxesBaseScript extends Script { public DynamicXPath bootStrap(String initialPath ){ this.binding.dxp.bootStrap initialPath } } And

DSL Recommendation

2018-01-10 Thread Mohan Radhakrishnan
Hi, I didn't know Groovy DSL's could be almost like plain english as shown in http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain- specific-languages.html Is that the latest recommendation ? My use case is this. I would like to create a small library to create XPath

Re: Catch clause difference

2018-01-10 Thread Mohan Radhakrishnan
Yes Jochen. That worked. import org.openqa.selenium.NoSuchElementException I hadn;t imported anything. Mohan On 9 January 2018 at 22:58, Jochen Theodorou <blackd...@gmx.org> wrote: > > > Am 09.01.2018 um 16:38 schrieb Dinko Srkoč: > >> On 9 January 2018 at 13

Re: Catch clause difference

2018-01-09 Thread Mohan Radhakrishnan
lt;dinko.sr...@gmail.com> wrote: > >> Is your `NoSuchElementException` in the catch clause by any chance >> `java.util.NoSuchElementException`? >> >> cheers, >> Dinko >> >> On 8 January 2018 at 16:18, Mohan

Re: Catch clause difference

2018-01-08 Thread Mohan Radhakrishnan
es printing out `nse` in both cases show? > > On Mon, Jan 8, 2018 at 11:02 PM, Mohan Radhakrishnan < > radhakrishnan.mo...@gmail.com> wrote: > >> Hello, >> >> These catch clauses are somehow different from each other. Why ? >> >> In the first case 'No

Catch clause difference

2018-01-08 Thread Mohan Radhakrishnan
Hello, These catch clauses are somehow different from each other. Why ? In the first case 'NoSuchElementException' is somehow escaping the 'catch' block. My test fails. But the second clause succeeds as expected. Clause 1 : catch( NoSuchElementException nse ){ throw new

Re: Unknown type: METHOD_DEF

2018-01-08 Thread Mohan Radhakrishnan
compileTests Thanks, Mohan On 8 January 2018 at 09:14, Mohan Radhakrishnan < radhakrishnan.mo...@gmail.com> wrote: > Hi Keith, > > The error when I run Maven test is this. > > [ERROR] Failed to execute goal org.codehaus.gmaven:gmaven- > plugin:1.2:g

Re: Unknown type: METHOD_DEF

2018-01-07 Thread Mohan Radhakrishnan
le(running) { > doSomeWork() > Thread.sleep(1000) { > // Called then Thread.sleep() is interrupted. > running = false > return true > } > } > } > // ... > t.interrupt() > t.join() > > > Finally, if you are doing complicated threading work you should really be > usin

Unknown type: METHOD_DEF

2018-01-05 Thread Mohan Radhakrishnan
Hi, I am new to groovy. Here I tried to create a simple wrapper around 'sleep'. I see the error in the subject at 'def'. What's wrong ? Thanks, Mohan /** * Our custom sleep logic. */ trait ThreadSleeper { long ms Closure cl = {} /*Sleep with an action taken*/

Re: Groovy code with Function or Predicate

2017-12-11 Thread Mohan Radhakrishnan
I posted this too soon. This line Function<WebDriver, Boolean> application = { wd -> wd.findElement(By.name("q"))} removes that error. Hope this is the right way. Thanks, Mohan On 11 December 2017 at 15:06, Mohan Radhakrishnan < radhakrishnan.mo...@gmail.com> wro

Groovy code with Function or Predicate

2017-12-11 Thread Mohan Radhakrishnan
Hi, When I try to pass a lambda to a Selenium API call I see this error. Believe this version of Selenium uses Guava lambdas. I understand that I need to be explicit and specify whether it is a Function or a Predicate. But don't know how to do this with groovy. So here I may have to explicitly