Project

General

Profile

Duplicate names

Added by Jim Fred over 10 years ago

I'm working on a Wt project with several WText objects that have unique pre-assigned names. The names are known at compile-time. Occasionally an object gets added during development with a duplicate name which results in unpredictable run-time behavior. Each time it happens, the cause is not obvious and the developer spends time debugging the problem.

I'd like to implement a check during initialization to check for duplicate names and throw an assert or log an error. Before I implement code to traverse the widget tree looking for duplicate names, I thought I'd check with the forum to see if a solution already exists that I'm not aware of.

I searched the forums for "duplicate names" and "unique names" and didn't see anything.

The purpose of the names is to retrieve data via the web-user-interface using xpath.

Thanks!

-Jim


Replies (2)

RE: Duplicate names - Added by Wim Dumon over 10 years ago

Hello Jim,

We don't do this check in Wt, I don't know of such functionality being available.

The following blog post may be interesting for you:

http://www.webtoolkit.eu/wt/blog/2013/05/13/selenium_node_locators_for_wt_and_jwt_applications/comments

BR,

Wim.

RE: Duplicate names - Added by Koen Deforche over 10 years ago

Hey,

With 'name' you really mean setObjectName()? These do not have to be unique (Wt doesn't rely on it anyway).

To be useful for locating nodes you should use the same as the selenium node locator: use hierarchies of names, and have a system where you make names unique only within the scope of another named element (widget).

Regards,

koen

    (1-2/2)