From: rbkcbe <rb...@gm...> - 2008-03-27 18:57:01
|
Dear Ahmed, I'm so glad to read the mail thread. Our requirement is exactly as you mentioned in earlier post "/html/body/table[3]/tr[5]/div/a" We've custom framework to select an element by specifying the AnchorText. In order to integrate our test written using (FitNesse + HtmlUnit) with other WebTest tools (Selenium) for complex AJAX calls where a real browser is must, we need the xPath information of the selected element. The above simple xPath is sufficient for the integration purpose. We don't need legible xPath so that other developers can understand. I'm fine with Marc suggestion - element.getCanonicalXPath() Hope I explained the requirement well. Thanks a lot Bala Ahmed Ashour wrote: > > Dear Bala, > > I am trying to understand, so please correct me. > >>>Using the class HtmlUnitXPath, we can get HtmlElements using xPath. > > You shouldn't directly use HtmlUnitXPath, you should use > element.getByXPath() instead. > >>> But how to get the xPath of selected HtmlElement? > > I guess this question should be: "how to get selected HtmlElement", right? > > Selected element is current element in focus? If yes, then > HtmlPage.getElementInFocus(). > > > But if you mean: how to get xpath of already returned elements from the > previous xpath expression, then this is a difficult question, for which a > feature request has to be created. > > Hope that helps, > > Yours, > Ahmed > > On Tue, Mar 25, 2008 at 9:59 AM, rbkcbe <rb...@gm...> wrote: > > > Dear All, > > Using the class HtmlUnitXPath, we can get HtmlElements using xPath. But > how > to get the xPath of selected HtmlElement? > > > > ____________________________________________________________________________________ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > -- View this message in context: http://www.nabble.com/How-to-get-xPath-from-HU-DOM-tree--tp16274911p16331159.html Sent from the HtmlUnit - General mailing list archive at Nabble.com. |