Click SWT.YES in MessageBox with unknown text

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Click SWT.YES in MessageBox with unknown text

Postby mwa » Thu Feb 12, 2009 7:30 am


I have written some tests for a plug-in that is generating PDF files from XML. Now as a new feature there pops up a message if something with the XML is wrong, asking if the PDF should be generated anyway. The test waits forever to this modal dialog. Since the XML is complex I cannot predict the title of the message box and what is say. Can be something like "LONGNAME Handling" or "Missing Element" in title and some corresponding message. But SWT.NO and SWT.YES are used. So it should be possible to hit the yes-bottom. I have read the documentation for a while but I cannot figure out a way to always hit the SWT.YES button. Perhaps I overlook something.

Would be nice if I can so something like this:
Code: Select all MessageBoxLocator(), SWT.YES);

But this is not supported. Is there any way to do this?

Posts: 24
Joined: Mon Jun 16, 2008 4:38 am

Re: Click SWT.YES in MessageBox with unknown text

Postby Phil Quitslund » Fri Feb 13, 2009 9:08 am

This definitely calls for a custom locator. We have some information and examples here that should help you get started:

If that does not get you up and running, let us know and we'll help you put one together.


Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest