From: George D. <lists@iDIAcomputing.com> - 2008-03-27 13:33:15
|
Marc Guillemot wrote: > Ahmed Ashour wrote: >> Dear Marc, >> >> It is true that there is no unique xpath expression, but having something >> like "/html/body/table[3]/tr[5]/div/a" can by used. > > this is an awful xpath xpath expression because it will probably stop to > work after a minimal change in the page, even when it is not related to > the targeted node. This kind of xpath expressions are typical from > people starting test automation of web applications. FWIW, I've found such canonical paths a helpful starting point when deciding on an effective xpath expression. Alex Chaffee's Xpath Explorer is the tool I've generally use (as dated as it is). I can envision that, were it available, a statement like assertEquals("", element.getCanonicalXPath()); might be a convenient shortcut to retrieving this information in the tool I'm already using. I'm not arguing for or against the facility; just pointing out how I might possibly use it were it available. - George P.S. Thanks for all the fine work on HtmlUnit! -- ---------------------------------------------------------------------- * George Dinwiddie * http://blog.gdinwiddie.com Software Development http://www.idiacomputing.com Consultant and Coach http://www.agilemaryland.org ---------------------------------------------------------------------- |