Hi,

I added the following method to DslContext,

  String getConsoleInput(){
    return (String)System.in.withReader {
      it.readLine()
    }
  }

In this way, you can call the getConsoleInput() method from Groovy or Java.
For example,

    @Test
    public void testGoogleSearch(){
        String input = ngsp.getConsoleInput();
        System.out.println("Get Console Input: " + input);

        ngsp.doGoogleSearch("tellurium selenium Groovy Test");
   }

The Maven 0.7.0-SNAPSHOT repo has been updated for this change.

Thanks,

Jian

On Thu, Jul 16, 2009 at 10:21 PM, John <[email protected]> wrote:

>
> Two good posts here,
>
>
> http://stackoverflow.com/questions/104254/java-io-console-support-in-eclipse-ide
>
> http://forums.techarena.in/software-development/1095321.htm
>
> Seems no way out. I will add a method in DslContext using System.in so
> that you
> can call it from your Java test class.
>
> Thanks,
>
> Jian
>
> On Jul 16, 10:05 pm, John <[email protected]> wrote:
> > Tried in Groovy, the following code works fine even in an IDE,
> >
> >       System.in.withReader {
> >         print 'input: '
> >         println it.readLine()
> >       }
> >
> > In Java, io.Console may have problem in IDE because usually the
> > testing
> > code run in a separate process and you may not be able to open
> > the console from there. Will see if there is any other way to get
> > around of this.
> >
> > Thanks,
> >
> > Jian
> > On Jul 15, 8:41 am, Jian Fang <[email protected]> wrote:
> >
> > > Interesting, will take a look later.
> >
> > > Thanks,
> >
> > > Jian
> >
> > > On Wed, Jul 15, 2009 at 2:16 AM, Harihara Vinayakaram <
> [email protected]>wrote:
> >
> > > > Hi Jian
> > > >   I think Selenium seems to over ride the System.in . Reading from
> > > > System.in / BufferedInputStream / Console etc none of the above was
> > > > successful . . I am running from a command line as part of a TestNG
> > > > ant task
> >
> > > >  We did a hack to check for the presence of a file / remove it etc .
> >
> > > >   But I am curious who overrides it
> >
> > > > Regards
> > > > Hari
> >
> > > > On Tue, Jul 14, 2009 at 6:18 PM, Jian Fang<[email protected]>
> > > > wrote:
> > > > > Seems Groovy also supports reading from stdin, take the example
> from
> >
> > > > >http://groovy-almanac.org/read-from-stdin/
> >
> > > > > System.in.eachLine() { line ->
> > > > > if(line.equals("exit"))
> > > > >     System.exit()
> > > > > else
> > > > >     println "you entered: $line"
> > > > > }
> >
> > > > > On Tue, Jul 14, 2009 at 8:45 AM, Jian Fang <
> [email protected]>
> > > > wrote:
> >
> > > > >> Java IO console class can do the similar thing,
> >
> > > > >>http://java.sun.com/javase/6/docs/api/java/io/Console.html
> >
> > > > >> But if you run in an IDE, I am not sure you could open the console
> using
> > > > >> Java IO console.
> >
> > > > >> Thanks,
> >
> > > > >> Jian
> > > > >> On Tue, Jul 14, 2009 at 7:52 AM, Harihara Vinayakaram <
> [email protected]
> >
> > > > >> wrote:
> >
> > > > >>> I solved this by putting a read() in the TestNG code . The user
> > > > >>> presses return in the window
> >
> > > > >>> Thanks
> > > > >>> Regards
> > > > >>> Hari
> >
> > > > >>> On Tue, Jul 14, 2009 at 4:01 PM, Harihara Vinayakaram<
> [email protected]
> >
> > > > >>> wrote:
> > > > >>> > Hi
> > > > >>> >  I have the following requirement . I have a set of tests which
> are
> > > > >>> > being run. But I would like to wait for some event . (i.e.) I
> would
> > > > >>> > like the user to click on the  page to do the next test .  I do
> not
> > > > >>> > want to pause for a fixed time . I would like the test to wait
> for a
> > > > >>> > click or some event and then proceed to the next test
> >
> > > > >>> > Is there a way I can implement this
> >
> > > > >>> > 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