Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » how to click a Coolbar item in SWTbot
how to click a Coolbar item in SWTbot [message #631392] Thu, 07 October 2010 11:54 Go to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
Hi,
I am a begineer in swtbot.

I can control the menu in swtbot.(sample codes shows as below)

I would like know how to click a coolbar item in SWTbot.
Anyone experience something similar?

Regards,
Patrick Hsieh

bot.menu("Help").menu("Install New Software...").click();

System.out.println("click on Install New Software...");
SWTBotShell shell = bot.shell("Install");
shell.activate();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
bot.button("Add...").click();
// find the new shell widget by its name
SWTBotShell shell1 = bot.shell("Add Repository");
shell1.activate();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
bot.textWithLabel("Name:").setText("test site");

bot.textWithLabel("Location:").setText("http://www.eclipse.org/swt/updates/3.6");

// verify button status
SWTBotAssert.assertEnabled(bot.button("OK"));

// Cancel it, in order to execute again and again
bot.button("Cancel").click();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
bot.button("Cancel").click();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
Re: how to click a Coolbar item in SWTbot [message #631633 is a reply to message #631392] Fri, 08 October 2010 09:09 Go to previous message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
I tried the method to launch a coolbar.

bot.toolbarDropDownButtonWithTooltip("New")
.menuItem("Project").click();
It works.
BR,Patrick

On 07.10.2010 13:54, Patrick wrote:
> Hi,
> I am a begineer in swtbot.
>
> I can control the menu in swtbot.(sample codes shows as below)
>
> I would like know how to click a coolbar item in SWTbot.
> Anyone experience something similar?
>
> Regards,
> Patrick Hsieh
>
> bot.menu("Help").menu("Install New Software...").click();
>
> System.out.println("click on Install New Software...");
> SWTBotShell shell = bot.shell("Install");
> shell.activate();
> try {
> Thread.sleep(3000);
> } catch (InterruptedException e) {
> }
> bot.button("Add...").click();
> // find the new shell widget by its name
> SWTBotShell shell1 = bot.shell("Add Repository");
> shell1.activate();
> try {
> Thread.sleep(3000);
> } catch (InterruptedException e) {
> }
> bot.textWithLabel("Name:").setText("test site");
>
> bot.textWithLabel("Location:").setText("http://www.eclipse.org/swt/updates/3.6");
>
>
> // verify button status
> SWTBotAssert.assertEnabled(bot.button("OK"));
>
> // Cancel it, in order to execute again and again
> bot.button("Cancel").click();
> try {
> Thread.sleep(3000);
> } catch (InterruptedException e) {
> }
> bot.button("Cancel").click();
> try {
> Thread.sleep(3000);
> } catch (InterruptedException e) {
> }
Previous Topic:Why is a menu item disabled when using SWTBot?
Next Topic:Problems running tutorial from command line on Linux
Goto Forum:
  


Current Time: Tue Apr 16 12:40:11 GMT 2024

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

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

Back to the top