Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SwtbotEclipseEditor.typeText() fails in Eclipse cocoa(Cannot use typeText() when automating eclipse cocoa)
SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #701436] Mon, 25 July 2011 05:40 Go to next message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
I am trying to use typeText() of SWTBotEclipseEditor in Eclipse 3.7 Cocoa. It fails with following message:

java.awt.AWTException : headless environment.

If I change Keyboard_strategy to SWTKeyboardStrategy , it fails with different message , "Could not post key event".

I have also set Keyboard_layout as MAC_EN_US. No clue whats happening. Any help would be appreciated

Here is my code,

SWTBotPreferences.KEYBOARD_STRATEGY = "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy";
if(SWT.getPlatform().equals("cocoa"))
	SWTBotPreferences.KEYBOARD_LAYOUT = "MAC_EN_US";
.....
.....
.....
SWTBotEclipseEditor textEditor = currentEditor.toTextEditor();
textEditor.typeText("testme");
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #702216 is a reply to message #701436] Tue, 26 July 2011 05:16 Go to previous messageGo to next message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
Any clues/hints on how to solve this ?
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #708865 is a reply to message #701436] Wed, 03 August 2011 08:32 Go to previous messageGo to next message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
Ok, I see that in Cocoa UI thread has to be the main thread to send OS key events. But SWTBot requires test to be started as non-UI thread.

So I switched KeyboardStrategy to MockKeyboardStrategy. But it still doesn't work. No exceptions, just doesn't type anything.

The issue is not only with editors, but any widget which can key events. Text, StyledText etc...

Has anyone successfully used Mock in cocoa?
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #709824 is a reply to message #701436] Thu, 04 August 2011 10:54 Go to previous messageGo to next message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
Can somebody please confirm that its not possible in cocoa?
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #710867 is a reply to message #701436] Fri, 05 August 2011 14:02 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
This should work, what version of macosx are you on?

-- Ketan

On 7/24/11 10:40 PM, Radhakrishna Bhat wrote:
> I am trying to use typeText() of SWTBotEclipseEditor in Eclipse 3.7
> Cocoa. It fails with following message:
>
> java.awt.AWTException : headless environment.
> If I change Keyboard_strategy to SWTKeyboardStrategy , it fails with
> different message , "Could not post key event".
>
> I have also set Keyboard_layout as MAC_EN_US. No clue whats happening.
> Any help would be appreciated
> Here is my code,
>
>
> SWTBotPreferences.KEYBOARD_STRATEGY =
> "org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy";
> if(SWT.getPlatform().equals("cocoa"))
> SWTBotPreferences.KEYBOARD_LAYOUT = "MAC_EN_US";
> ....
> ....
> ....
> SWTBotEclipseEditor textEditor = currentEditor.toTextEditor();
> textEditor.typeText("testme");
>
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #713252 is a reply to message #710867] Mon, 08 August 2011 09:12 Go to previous messageGo to next message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
I am on Mac 10.6.5 .
Eclipse version 3.7 Cocoa 32 bit
Re: SwtbotEclipseEditor.typeText() fails in Eclipse cocoa [message #713828 is a reply to message #713252] Tue, 09 August 2011 06:56 Go to previous message
Radhakrishna Bhat is currently offline Radhakrishna BhatFriend
Messages: 6
Registered: July 2011
Junior Member
Hi Ketan,

Did you get a change to look at this issue? Is Key typing working for you on Eclipse cocoa?
Previous Topic:Getting the Wizard member variables of One Page in other Wizard Page.
Next Topic:How to handle NatTable?
Goto Forum:
  


Current Time: Fri Mar 29 12:44:24 GMT 2024

Powered by FUDForum. Page generated in 0.02300 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top