Hi Olivier, I think I know where the confusion comes from, I should really have addressed this when answering your previous question but for some reason it slipped my mind - sorry.
qooxdoo widgets can have two kinds of child widgets: * "public" children that are added by the application developer using the widget's add() method. Calling getChildren() on the widget returns these. * "internal" children AKA child controls that are created implicitly by the widget itself. These are returned by _getChildren(). The TabView's public children are the Pages, while its internal children are the SlideBar that contains the Buttons and the Stack that *actually* contains the Pages. The Inspector's "widgets" window only displays the public children by default, click the page/wrench button followed by the window's reload button to display both internal and external children. The qxh locator actually checks *both* kinds of widgets for each locator step: It calls first getChildren and then _getChildren on the widget found by the previous step, concats the two arrays, then checks the resulting list for a match. This is why both qxh=qx.ui.tabview.TabView/child[0] and qxh=qx.ui.tabview.TabView/child[3]/child[0] return the same widget, namely the first tabview.Page: The second locator takes a "detour" through the Stack container which really contains the pages but is hidden from the developer using the public API. I guess the lesson to draw from all this is that when writing locators, it's best to be as specific as possible for each step, avoiding wildcards and only using child[i] steps if you're certain what they'll find. Apart from all that, there's the problem of finding the children of any tabview.Page other than the one that is active on application startup: The DOM nodes for the widgets on a tabview page are created lazily; they don't exist until the page is activated. Selenium always works on DOM nodes, so for a page that has never been active, the locator will find a widget but then calling getContentElement().getDomElement() on it returns null. In Selenium IDE, this is easy to spot: # [debug] Qxh Locator: Terminating search, found match; last step :child[1], element: qx.ui.tabview.Page[99] # [error] locator not found: qxh=qx.ui.tabview.TabView/child[1], error = Error: Element qxh=qx.ui.tabview.TabView/child[1] not found It also makes sense to click the page button first simply because that's what a user interacting with the page would do, and simulating user interaction is the whole point of the exercise :) Regards, Daniel Olivier ZORO-BI schrieb: > Olivier ZORO-BI wrote: >> Hi, >> Last time, I couldn't access TabviewPages of a tabview with Selenium. I >> asked questions about it and I finally found >> tabviewlocator/child[2]/child[i] although Qooxdoo inspector shows me >> that tabviewPage is the direct child of tabview in my application. >> >> I didn't understand this formula but it worked until today with a >> tabview used with a tree. Does someone know something about this problem? >> I would like to access the tabviewPages with a property (widgetId) like >> all my other widgets : tabviewlocator/*/[...@widgetid=tabviewpage] or with >> the label but it doesn't work. >> >> Thanks for your help. >> >> Olivier >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> qooxdoo-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel >> >> > Hi again, I used Selenium IDE debug to have more information about it. > In facts, in tabviewlocator/child[2]/child[i], child[2] is a > qx.container.SlideBar which might automatically be added with tabview > because I did not find it in my code. > And child[i] is a qx.ui.tabview.TabButton which is not either in my code. > > I can only access my tabviewPages if I have already click on it and I > was doing that with child[2]/child[i]. Otherwise, the tabviewPage is not > found by Selenium. > Isn't it any other way to click the tabviewPages ( without > qx.ui.tabview.TabButton which doesn't appear in the code) or is it > possible to give this widget a property like the others (wigdetId). > > Thanks. > > Olivier. > > ------------------------------------------------------------------------------ > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
