Re: [tclwebtest] Bug in matching syntax of "link follow" and relative url construction
Status: Abandoned
Brought to you by:
tils
From: Grzegorz A. H. <gr...@ef...> - 2003-02-12 18:26:38
|
On Wed, Jan 29, 2003 at 06:17:40PM +0100, Grzegorz Adam Hankiewicz wrote: > Hi. > > Looks like the absence of a selftest for "link follow ~c" has let > this bug survive, the search is done in the full html instead of > just the content. > [...] > --- do_request for http://slashdot.org/ > http status: >>200<< > <A HREF="//slashdot.org/search.pl?topic=126"><IMG > SRC="//images.slashdot.org/topics/topictech2.gif" > WIDTH="60" HEIGHT="80" > BORDER="0" ALT="Technology"></A> > --- do_request for http://slashdot.org//slashdot.org/search.pl?topic=126 > [...] > link find ~c "topics" > log [link get_full] > [...] Oh, this was a wrong analysis on my part. tclwebtest correctly searches for the content of all available links. The problem is that when I wrote that script, searching for the "topics" link, and the found hyperlink contained the word "topic", I thought the search was being done on the raw html of the hyperlink. If you try with your text editor to search the word "topics" in that log, you will find out that the search was done correctly, and it was the html img code containing the word topics which triggered the false hit. Since I expect "link find" and related to search in plain text, the solution is quite simple: stripping the html when retrieving the links. Index: lib/tclwebtest.tcl =================================================================== RCS file: /cvsroot/tclwebtest/tclwebtest/lib/tclwebtest.tcl,v retrieving revision 1.20 diff -u -r1.20 tclwebtest.tcl --- lib/tclwebtest.tcl 12 Feb 2003 16:59:57 -0000 1.20 +++ lib/tclwebtest.tcl 12 Feb 2003 18:14:16 -0000 @@ -2146,7 +2146,7 @@ # this is way too simple regexp -nocase {>(.*)<} $a_link(full) match a_link(content) - set a_link(content) [normalize_html $a_link(content)] + set a_link(content) [util_remove_html_tags [normalize_html $a_link(content)]] lappend ::tclwebtest::links [array get a_link] This patch makes my script work as I expected, but maybe this is not the exact behaviour tclwebtest should have. What do you think about it? After all, if somebody is searching for exact html code, the use of 'link find ~f xxx' should be good enough. -- Grzegorz Adam Hankiewicz, gr...@ef.... Tel: +34-94-472 35 89. eFaber SL, Maria Diaz de Haro, 68, 2 http://www.efaber.net/ 48920 Portugalete, Bizkaia (SPAIN) |