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 07:54 Go to next message
Patrick is currently offline Patrick
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 05:09 Go to previous message
Patrick is currently offline Patrick
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: Sat Jul 26 09:12:54 EDT 2014

Powered by FUDForum. Page generated in 0.04384 seconds