From: Barnaby C. <Ba...@ac...> - 2003-06-03 18:41:35
|
Hi, You should be able to do this using the HtmlPage.getFirstAnchorByText() method. Good Luck, -Barnaby ---------- Original Message ---------------------------------- From: "Glanville, Jay" <Jay...@Na...> Date: Tue, 3 Jun 2003 14:32:05 -0400 >Hello all. Nice new list! > >I have a question or two for the community: > >There is an HTMLPage.getAnchorByHref() function, and an >HTMLPage.getAnchorByName() function, but there isn't an >HTMLPage.getAnchorByText() function. The reason I need this is because the >name attribute isn't used, and I can't guarantee what the href value will be >(it will contain the user's id, which is dynamically created). > >I know that the web app will reply with something like this: > > <a href=".../someJsp.jsp?id=66">Edit John</a> > >So, I thought to myself, I'd write a utility method that uses the >HTMLPage.getAnchors() method, goes through the list of resulting HTMLAnchor >objects looking for something with the content of "Edit John". However, I >can't figure out how to get the content of an A element out of the >HTMLAnchor object. > >So, question one: is there an easy way to get an HTMLAnchor object out of an >HTMLPage by querying based on the content of the tag? > >Question two (if question one forces me to write my utility method): how do >I get the content of an A tag out of the HTMLAnchor object? > >Thankx > >JDG > >PS: Hopefully enough of the designers mailing list has signed up to the >users list so that there is enough of a population to read my query. ;-) > >-- >Jay Glanville >Web Developer >jay...@na... >(613) 725-2030 x393 > > > >------------------------------------------------------- >This SF.net email is sponsored by: eBay >Get office equipment for less on eBay! >http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >_______________________________________________ >Htmlunit-user mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |