SWTBOT selecting text of a dialog - swtbot

i'm running a SWTBot test and i don't know how to select the text(message) of a dialog.
i can get the text of the shell like:
bot.activeShell().getText().equals("Login error")
seen method for tooltip but not message.
Thanks

shell.getText() would return the Shell title.
If you want the message inside the dialog, then you have to "find" it. You'll probably need to use "bot.label()" and similar methods.

Related

How to call a Dialogue box from Menu using Matlab?

I want to Make a Help Dialogue Box. When we Press Help Menu then Dialogue box will appear.
Current code is
h_opt3 = uimenu('Label','&Help');
uimenu(h_opt3,'Label','How to Use','Callback','dialog','separator','on');
It only show empty dialog.
In place of dialog i want to put a dialogbox which will describe how to use my software.
How to code this all. Please help.
Requirements: How to Add stuff in DialogBox and how to call it in above mention scenario.
Try writing an additional callback function, and look at helpdlg instead of dialog.
I can't test any code now, but something like the following should work.
function help_callback
h = helpdlg('Directions','title');
end
Then change your uimenu call to this code
uimenu(h_opt3,'Label','How to Use','Callback',#help_callback,'separator','on');

using protractor mouseMove to click on a drop-down

I am using the following to get protractor to click on a drop-down menu.
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).click();
However this does nothing which is to say that the drop-down does not get clicked and no errors are displayed.
What am I missing here ?
For the benefit of those who landed on this page. The solution is to use .perform at the end.
here is the working version
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).click().perform();
Actually you don't have to use actions, with actions you can not select option that is not currently visible in the screen.
use this:
element(by.xpath("//a[#tooltip='Portfolios']")).click();
I suppose you should only use perform, like:
ptor.actions().mouseMove(
ptor.findElement(protractor.By.xpath("//a[#tooltip='Portfolios']"))
).perform();

LWUIT menuBar refreshTheme not working?

I'd like to dynamically change the text of a Command depending on some state, so normally I went to Google and LWUIT blogs said that using refreshTheme() on MenuBar should do the trick.
So I used the following code, but it sadly didn't work
if (isPlaying) {
playButton.setCommandName("Pause");
}else{
playButton.setCommandName("Play");
}
this.getMenuBar().refreshTheme();
Is there something wrong with my code? Or did I misunderstand something?
It won't refresh. The text of the button is set when the command is placed so you can't do that.
You will need to use removeCommand(cmd) followed by addCommand(newCmd).
Furthermore, refreshTheme() has absolutely nothing to do with anything.

create a dialog using menu in eclipse plugin

I am creating a popupmenu(org.eclipse.ui.popupMenus) in my eclipse plugin. Now I want to launch one textfield or dialog to take user input. And on based on input I will run my run method associated with the popupMenu. Please help me out.
In it's most basic interaction, you could use org.eclipse.jface.dialogs.MessageDialog.openQuestion(Shell, String, String) to have the user answer a yes/no question.
If you'd like them to enter a string, you can use org.eclipse.jface.dialogs.InputDialog. After it's closed, getValue() returns their input.

Unable to locate WindowID

I am currently testing a web app using selenium rc with eclipse. I've been having issues with a single pop up window which appears when a submit button is clicked. The confirmation window appears with a single 'ok' option.
I've also tried 'chooseOKonnextConfirmation' in conjunction with .getConfirmation but eclipse tells me no confirmation exists. I've tried inspecting the window itself with firebug but have been unable to get any results.
I also tried with "selenium.selectWindow(getAllWindowIDs ()[1]);" but selenium not recognizing "getAllWindowIDs".
Could somebody please tell me how I can retrieve the windowID and the associated API commands I need to implement to get rid of this problem?
from your description, i understand that you have an ALERT window being appeared after clicking SUBMIT button but not the CONFIRMATION window.
if my understanding is correct
( you said single OK button - ALERT window appears with single OK button - CONFIRMATION window appears with OK and CANCEL buttons - there is another window javascript can generate which is CONFIRMATION.it appears with TEXT field and OK and CANCEL buttons )
so you must use accordingly.
here is what you should use
if(selenium.isAlertPresent()) {
String message = selenium.getAlert();
}
this will consume you Alert window and you can check the message displayed on Alert window if you want.
if this is not please post write your comment
It's selenium.getAllWindowIds(); note the capitalisation. Don't forget to make sure the popup has already appeared (e.g. selenium.waitForPopUp()).
Yes sudarsan is correct if you have an alert.
If you have an popup window not an alert with OK button then you have to click OK when popup appears.
If you are unable to locate the button use firebug to locate the element.