Posts

Showing posts with the label javascript

System Testing Bookmarklets: Selenium

My switch search engine bookmarklet had two bugs. First when I deployed the page, the URL was screwed up (thanks for telling me Chris) and second my bookmarklet was incompatible with FireFox[1].   Conveniently the software engineering community has a solution to this class of problems and it's called  system testing. In this context, System testing means interact with the web pages via a browser just like users do.  I did some digging and I couldn't find a perfect (or awesome) tool for system testing web apps. I was able to get a tool that could drive FireFox and Chrome (IE isn't working).  This tool had some warts, and took some experimentation to get working, but it mostly meets the needs. Please comment if you find a better tool! The tool I used is called Selenium , and it's scriptable via python (also Java and C#). Selenium is able to impersonate a user performing actions via the common web browsers. The code below should make reasonable sense to someone f...

Assembly to JavaScript;TSRs to Bookmarklets

Image
Back when I started computing (the nineties), the coolest thing to to know was assembly. If you knew assembly you could make the computer do anything because the computer was essentially executing assembly[1]. Back in those days the way to inject code into the system was something called a Terminate And Stay Resident ( TSR ). This mini application could be invoked via a hotkey and run arbitrary code in your memory space - this was a great way to hack applications, or provide additional capabilities to programs. Luckily history repeats itself.  Today, assembly has been replace by JavaScript, and  the mechanism for  TSRs is called bookmarklets. Bookmarklets are book marks which execute arbitrary javascript code. To show you the power of bookmarklets I wrote a JavaScript bookmarklet that will take a search from  bing and run it on google or vice versa. You can install it by dragging  SwapSearchEngine  to your bo...