Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Can SWTBot be used to scrape the Console view?
Can SWTBot be used to scrape the Console view? [message #526139] Thu, 08 April 2010 16:32 Go to next message
Jeff Johnston is currently offline Jeff Johnston
Messages: 169
Registered: July 2009
Senior Member
Is there a way using SWTBot to get the contents of the Console tab? It isn't clear to me how to go about this.
Re: Can SWTBot be used to scrape the Console view? [message #526147 is a reply to message #526139] Thu, 08 April 2010 17:36 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Jeff Johnston wrote:
> Is there a way using SWTBot to get the contents of the Console tab? It
> isn't clear to me how to go about this.

SWTBotStyledText styledText = new
SWTWorkbenchBot().viewByTitle("Console").bot().styledText(); ??

I think the console view use a styled text. Might also be a plain Text.
Dunno.

Hope this helps.
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: Can SWTBot be used to scrape the Console view? [message #526158 is a reply to message #526147] Thu, 08 April 2010 22:32 Go to previous message
Ralf Ebert is currently offline Ralf Ebert
Messages: 168
Registered: July 2009
Senior Member
Hi Jeff,

> SWTBotStyledText styledText = new
> SWTWorkbenchBot().viewByTitle("Console").bot().styledText(); ??

yes, I was just curious about it, this works as proposed by Pascal:

public class SampleIDETest {

private SWTWorkbenchBot bot = new SWTWorkbenchBot();

@Test
public void testConsole() throws Exception {
SWTBotView consoleView = bot.viewByTitle("Console");
consoleView.show();
assertEquals("hi\n", consoleView.bot().styledText().getText());
}

}

btw: To determine the type of a widget you want to work with it's very helpful to run the
application with the SWTBot Spy plug-in. The spy plug-in view shows for the console text:

//Shell/-1//Composite/4//Composite/0//Composite/3//Composite /0//PageBook/0//StyledText/1

Greetings,

Ralf



--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Previous Topic:Would like to have relative searching based on Composite parent
Next Topic:SWTBotTreeItem.doubleClick() not posting mouse coordinates
Goto Forum:
  


Current Time: Wed Apr 16 00:34:21 EDT 2014

Powered by FUDForum. Page generated in 0.02305 seconds