From: Marvin.Adami <htm...@ey...> - 2005-09-02 19:55:08
|
This would be great :) would you give some additinal infos on extending htmlunit? :) > Yes it is the only one implemented in HtmlUnit (well, I know only this > one). But it's quite easy do write one's own methods to doing other > searches. > I did one to looking for image links. I can post it if you want. >=20 > Romain >=20 > Marvin.Adami a =E9crit : >=20 >> Thanks to you both :) >> >> It works :) The link is >> >> <a href=3D"/concepts/createSubConcept.htm?id=3Droot" class=3D"function= ">Neu >> anlegen</a> >> >> Is getFirstAnchorByText the only possibility (this question is only fo= r >> learning puposes). >> >> =20 >> >>> Are you sure that "Neu anlegen" is the name attribute of the anchor, = or >>> the text between <a> and </a>. In the second case, you need >>> getFirstAnchorByText() instead. >>> It may also be a problem with frames. If the link is in the frame, yo= u >>> must get the HtmlPage enclosed in the frame before looking for the li= nk. >>> You can do that with : >>> getFrameByName("thename").getEnclosedPage().getAnchorByName("Neu >>> anlegen").click(); >>> >>> Hope it helps, >>> Romain >>> >>> Marvin.Adami a =E9crit : >>> >>> =20 >>> >>>> I tried it the same way bevore posting here, but it dident work. >>>> >>>> final HtmlPage page4 =3D (HtmlPage) page3.getAnchorByName("Neu >>>> anlegen").click(); >>>> >>>> I've checked page3.asXml() to determine, that page3 is the page i >>>> expect. and it is. the link "Neu anlegen" is available. but i got th= e >>>> following error: >>>> >>>> com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=3D= [a] >>>> attributeName=3D[name] attributeValue=3D[Neu anlegen] >>>> at >>>> com.gargoylesoftware.htmlunit.html.HtmlElement.getOneHtmlElementByAt= tribute(HtmlElement.java:451) >>>> >>>> >>>> >>>> >>>> >>>> >>>> Romain Thouvenin schrieb: >>>> >>>> >>>> =20 >>>> >>>>> To click a link, use getAnchorByName or getFirstAnchorByText, then >>>>> theAnchor.click(). >>>>> With the cookbook, the javadoc and some willingness, i managed to g= et >>>>> used to htmlunit, but you right, it would be great with a complete >>>>> manual. >>>>> Anyway, when you want some help, look for HtmlXXX in javadoc where = XXX >>>>> is the tag nameof the concerned html element, and navigate ;) You >>>>> should >>>>> get some useful information and with a few tests, manage to do what >>>>> you >>>>> want. Or else, write here :) >>>>> >>>>> Romain >>>>> >>>>> Marvin.Adami a =E9crit : >>>>> >>>>> =20 >>>>> >>>>> =20 >>>>> >>>>>> hello, >>>>>> >>>>>> how to click a link with htmlunit? the estimated page.clickLinkByN= ame >>>>>> is not available. and is there any possibility to get more basic >>>>>> information about using htmlunit? only using the api doc is not ve= ry >>>>>> simple for a new htmlunit user. >>>>>> >>>>>> thanks >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------- >>>>>> SF.Net email is Sponsored by the Better Software Conference & EXPO >>>>>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >>>>>> Practices >>>>>> Agile & Plan-Driven Development * Managing Projects & Teams * Test= ing >>>>>> & QA >>>>>> Security * Process Improvement & Measurement * >>>>>> http://www.sqe.com/bsce5sf >>>>>> _______________________________________________ >>>>>> Htmlunit-user mailing list >>>>>> Htm...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> =20 >>>>> >>>>> >>>>> ------------------------------------------------------- >>>>> SF.Net email is Sponsored by the Better Software Conference & EXPO >>>>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >>>>> Practices >>>>> Agile & Plan-Driven Development * Managing Projects & Teams * Testi= ng >>>>> & QA >>>>> Security * Process Improvement & Measurement * >>>>> http://www.sqe.com/bsce5sf >>>>> _______________________________________________ >>>>> Htmlunit-user mailing list >>>>> Htm...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >>>>> >>>>> >>>>> >>>>> =20 >>>>> =20 >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------- >>>> SF.Net email is Sponsored by the Better Software Conference & EXPO >>>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >>>> Practices >>>> Agile & Plan-Driven Development * Managing Projects & Teams * Testin= g >>>> & QA >>>> Security * Process Improvement & Measurement * >>>> http://www.sqe.com/bsce5sf >>>> _______________________________________________ >>>> Htmlunit-user mailing list >>>> Htm...@li... >>>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >>>> >>>> >>>> >>>> >>>> =20 >>> >>> >>> >>> ------------------------------------------------------- >>> SF.Net email is Sponsored by the Better Software Conference & EXPO >>> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >>> Practices >>> Agile & Plan-Driven Development * Managing Projects & Teams * Testing >>> & QA >>> Security * Process Improvement & Measurement * >>> http://www.sqe.com/bsce5sf >>> _______________________________________________ >>> Htmlunit-user mailing list >>> Htm...@li... >>> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >>> >>> >>> >>> =20 >> >> >> >> >> >> ------------------------------------------------------- >> SF.Net email is Sponsored by the Better Software Conference & EXPO >> September 19-22, 2005 * San Francisco, CA * Development Lifecycle >> Practices >> Agile & Plan-Driven Development * Managing Projects & Teams * Testing >> & QA >> Security * Process Improvement & Measurement * http://www.sqe.com/bsce= 5sf >> _______________________________________________ >> Htmlunit-user mailing list >> Htm...@li... >> https://lists.sourceforge.net/lists/listinfo/htmlunit-user >> >> >> =20 >> >=20 >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Pract= ices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing &= QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5= sf > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user >=20 >=20 >=20 |