Re: [TFUI] TFUI for web applications -- writing reveal() methods
Hristo Deshev <[email protected]> Thu, 25 Aug 2005 22:33:12 +0300
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
Hi Phlip, On 8/25/05, Phlip <[email protected]> wrote: [snip] Next, if you simulate a browser (like with HttpUnit), you can put > together another incomplete reveal() by writing the current page's > HTML to scratch.html, and raising this in a browser. This technique > discards DOM interactivity (the simulated JavaScript might not run), > and it requires scratch.html can see relative paths to its support > files, such as "/images/penBird.png" or > "/scripts/myFavoriteScripts.js". I learned a valuable trick from a coworker of mine: the <base> tag. Adding a <base href="http://someUrl.com/"> to your page will base all the relative path calculations on the url. You are supposed to place it in your <head> section, but browsers will accept it anywhere. I just wrote a simple reveal() method in ruby: def reveal(html, baseUrl) File.open("output.html", "w") do |output| output.puts "<base href='#{baseUrl}'>" + html end system "cmd.exe /c start output.html" end A call like: reveal page.body, "http://clubs.dir.bg/" will base all the paths in output.html on the base URL of a popular Bulgarian forum site. I'd like to second the Watir recommendation. Using it is a piece of cake. Hristo Deshev http://muslon.blogspot.com [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h721s5r/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1125005599/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/">In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!</a>.</font> --------------------------------------------------------------------~-> To unsubscribe, email: TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/TestFirstUserInterfaces/ <*> To unsubscribe from this group, send an email to: TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/