Skip to main content


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 20:32 Go to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
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 21:36 Go to previous messageGo to next message
Pascal G is currently offline Pascal GFriend
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] Fri, 09 April 2010 02:32 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
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: Fri Apr 19 02:52:31 GMT 2024

Powered by FUDForum. Page generated in 0.02384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top