How to set focus on a Native dialog while using SWTBOT?

139 views Asked by At

I open a file selection native dialog using SWTBot. But somehow it is never on focus. I understand that SWTBot doesn't support Native dialogs. I just want to do some keyboard actions on the dialog. Which is only possible if the focus in on the dialog.

If I manually click on the native dialog or the eclipse behind it, i'm able to get focus. Is there a way to programatically achieve this?

I tried these:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setActive();

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();

Also tried using ALT+TAB. Haven't been able to do this.

1

There are 1 answers

0
Majlik On

Yes SWTBot doesn't support native dialogs and for this you can use LDTP with its method to activate specific window and then it may work for you.