From: <ddk...@ki...> - 2005-04-20 19:15:49
|
In the project I just finished up, we had a requirement to test that certain text entered in a text field (or textare field) in one part of our application would appear in another part of the application. To do this, we put <span></span> tags around the text (unless it was already contained by another tag, like <h1></h1>), then set a unique "id" attribute on the <span> or other tag. <span id="heading-foo-bar">Baz Heading</span> This allowed us to "find" the tag we were looking for on the page (by the "id" attribute), then grab the contents of the tag to assert that it matched the original text entered. Usually, we also added either "style" or "class" attributes to the <span> tag to style the text as well. Note that the <span> does not alter the formatting of the page (unless you start adding "style" or "class" attributes), so it's a great way to "find" the text you're looking for immediately. Dave On Wed, Apr 20, 2005 at 06:06:06PM +0200, Ducloux Victor wrote: > Hi everybody, I succeeding in doing some things with htmlunit and forms... > but now I would like to know how to search a certain text in a web page > like 'Welcome to my web page'... > > I really can't find out in the api doc.... > Thanks in advance, > > Victor |