Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Problem to get instance of org.eclipse.swt.WidgetManager(Unable to access WidgetManager via javascript)
Problem to get instance of org.eclipse.swt.WidgetManager [message #657699] Thu, 03 March 2011 16:34 Go to next message
Christian A is currently offline Christian AFriend
Messages: 13
Registered: March 2011
Junior Member
Im trying to test a RAP application with selenium.
To obtain information about the state of UI widgets, i will access the
org.eclipse.swt.WidgetManager to retrieve widgets by their id.

In the user-extensions-qooxdoo.js file i added the following function:

Selenium.prototype.getWidgetById = function(locator){
	var uwindow = this.browserbot.getUserWindow();
	var wmanager = uwindow.org.eclipse.swt.WidgetManager.getInstance();
	// obtain reference to widget
	widget = wmanager.findWidgetById(locator);
	
	return widget != null;
 }


In selenium IDE the following exception is thrown:

[error] Unexpected Exception: message -> wmanager.findWidgetById(locator) is undefined, fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/iDARE.WEST/rap_UITest/scripts/user-extensions-qoo xdoo.js, lineNumber -> 115, stack -> ("userEmailTxt","")@chrome://selenium-ide/content/tools.js -> file:///C:/iDARE.WEST/rap_UITest/scripts/user-extensions-qoo xdoo.js:115 ("userEmailTxt","" )@chrome://selenium-ide/content/selenium/scripts/htmlutils.j s:60 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/sele nium-commandhandlers.js:330 ()@chrome://selenium-ide/content/selenium/scripts/selenium-e xecutionloop.js:112 (1)@chrome://selenium-ide/content/selenium/scripts/selenium- executionloop.js:78 (1)@chrome://selenium-ide/content/selenium/scripts/htmlutils .js:60 , name -> TypeError

I also tried to get the WidgetManager directly using 'var wmanager = org.eclipse.swt.WidgetManager.getInstance()'. In this case a similar exception 'org is undefined' appeared. If i change 'this.browserbot.getUserWindow' in 'this.browserbot.getCurrentWindow' an exception 'getCurrentWindow().org is undefined' is thrown.

Has anybody an idea, how i can fix it?

Thanks in advance

[Updated on: Thu, 03 March 2011 16:40]

Report message to a moderator

Re: Problem to get instance of org.eclipse.swt.WidgetManager [message #657718 is a reply to message #657699] Thu, 03 March 2011 17:26 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi Christian.

> wmanager.findWidgetById(locator) is undefined, fileName ->

Sounds to me like you actually get the WidgetManager, but there simply
is no widget with that id. I know next to nothing about selenium, but
what value is "locator", where does it come from? You should know that
the Widget-IDs in RAP are only used by the Server to get the
widget-instance, they have nothing to do with the html-attribute "id".
Perhaps that helps.

Greetings,
Tim
Re: Problem to get instance of org.eclipse.swt.WidgetManager [message #657727 is a reply to message #657718] Thu, 03 March 2011 17:57 Go to previous messageGo to next message
Christian A is currently offline Christian AFriend
Messages: 13
Registered: March 2011
Junior Member
Hi Tim,

to improve the testability, i assigned custom widget ID's
e.g. 'emailText.setData(WidgetUtil.CUSTOM_WIDGET_ID, "userEmailTxt")'.
The custom ID's are used on server side and also as Element-ID's for the generated HTML output.

The ID is passed as input parameter 'locator' to the javascript function.

If i try to retrieve a widget using one of the generated ID's (e.g. 'w26'), the same error message appears.

Christian
Re: Problem to get instance of org.eclipse.swt.WidgetManager [message #657944 is a reply to message #657727] Fri, 04 March 2011 17:02 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Am 03.03.2011 18:57, schrieb Christian A:
> Hi Tim,
>
> to improve the testability, i assigned custom widget ID's e.g.
> 'emailText.setData(WidgetUtil.CUSTOM_WIDGET_ID, "userEmailTxt")'.
> The custom ID's are used on server side and also as Element-ID's for the
> generated HTML output.

In that case, can you confirm with firebug (or some other DOM-inspector)
that the id has really been set?
Can you call other functions on WidgetManager, like toString?
Can you access other objects in the window object, like document.body?

Tim
Re: Problem to get instance of org.eclipse.swt.WidgetManager [message #658413 is a reply to message #657944] Tue, 08 March 2011 12:44 Go to previous message
Christian A is currently offline Christian AFriend
Messages: 13
Registered: March 2011
Junior Member
I solved the problem.

As you mentioned i got the reference to the WidgetManager correctly, but the function 'getValue()' is not defined for the widget type i tried to evaluate.

In a copy of the qooxdoo SDK i found a complete API documentation of the qooxdoo javascript widget implementation.

Thanks for your advice.

Christian
Previous Topic:PlatformUI.getPreferenceStore() without values?
Next Topic:Tree control over IPad
Goto Forum:
  


Current Time: Sun Oct 24 00:06:33 GMT 2021

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

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

Back to the top