From: Ahmed A. <asa...@ya...> - 2014-03-13 14:40:48
|
Hi Vasu, Raj reply is much better, mine is more complex. You need to change the assumptions (and code) when the website changes. Ahmed ________________________________ From: Vasudevan Comandur <vco...@gm...> To: Ahmed Ashour <asa...@ya...>; "htm...@li..." <htm...@li...> Sent: Thursday, March 13, 2014 4:10 PM Subject: Re: [Htmlunit-user] How to get the Label Text associated with a HTMLInput field where type=text Hi Ahmed, Thanks for your reply. Can I assume that the Label node will be the preceding node always in the DOM?. Will there not be any other HTML tag coming between INPUT & LABEL tag? Regards Vasu On Thu, Mar 13, 2014 at 6:09 PM, Ahmed Ashour <asa...@ya...> wrote: Hi Vasu, > > >You can use page.getFirstByXPath() with "preceding-sibling" > > >An example can be found in http://stackoverflow.com/questions/9879425/combining-xpath-axes-preceding-sibling-following-sibling > > > >Ahmed > >________________________________ > From: Vasudevan Comandur <vco...@gm...> >To: "htm...@li..." <htm...@li...> >Sent: Thursday, March 13, 2014 3:28 PM >Subject: [Htmlunit-user] How to get the Label Text associated with a HTMLInput field where type=text > > > >Hi, > > I would like to know how to get the Label Text associated with a HTMLInput > field where type=text in HTMLUnit > > I am copying below a snippet from an HTML page > > <label>Password:</label> > <input type="text" id="otpMobilePassword" name="otpMobilePassword"> > <br/> > >Regards > Vasu > >------------------------------------------------------------------------------ >Learn Graph Databases - Download FREE O'Reilly Book >"Graph Databases" is the definitive new guide to graph databases and their >applications. Written by three acclaimed leaders in the field, >this first edition is now available. Download your free book today! >http://p.sf.net/sfu/13534_NeoTech >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > > >------------------------------------------------------------------------------ >Learn Graph Databases - Download FREE O'Reilly Book >"Graph Databases" is the definitive new guide to graph databases and their >applications. Written by three acclaimed leaders in the field, >this first edition is now available. Download your free book today! >http://p.sf.net/sfu/13534_NeoTech >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > |