how to click a Coolbar item in SWTbot [message #631392] |
Thu, 07 October 2010 07:54  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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) {
> }
|
|
|
Powered by
FUDForum. Page generated in 0.04466 seconds