<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - noah</title>
<link>http://snipplr.com/users/noah/tags/javascript</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Wed, 15 Feb 2012 19:03:47 GMT</pubDate>
<item>
<title>(Ruby) Howto set up a Rake task to start and stop the Selenium-RC server</title>
<link>http://snipplr.com/view/27992/howto-set-up-a-rake-task-to-start-and-stop-the-seleniumrc-server/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Mon, 08 Feb 2010 23:01:08 GMT</pubDate>
<guid>http://snipplr.com/view/27992/howto-set-up-a-rake-task-to-start-and-stop-the-seleniumrc-server/</guid>
</item>
<item>
<title>(HTML) Bookmarklet Template: turn any snippet of JavaScript code into a Bookmarklet</title>
<link>http://snipplr.com/view/22806/bookmarklet-template-turn-any-snippet-of-javascript-code-into-a-bookmarklet/</link>
<description><![CDATA[ <p>[Will](http://twitter.com/wschenk) originally showed me how easy it is to transform random JS snippets into bookmarklets.  Once you set up the HTML, just view it in Firefox, and then drag the link to your bookmarks toolbar.

The basic form is 

&amp;lt;a href="javascript:CODE;void 0;"&amp;gt;NAME&amp;lt;/a&amp;gt;

Where `CODE` is any arbitrary JavaScript code, and `NAME` is the name you want the bookmarklet to have once it has been added to the Firefox toolbar.

And of course *don't use the javascript: protocol* in your HTML pages -- although it's (only!) OK for bookmarklets.</p> ]]></description>
<pubDate>Mon, 09 Nov 2009 17:34:49 GMT</pubDate>
<guid>http://snipplr.com/view/22806/bookmarklet-template-turn-any-snippet-of-javascript-code-into-a-bookmarklet/</guid>
</item>
<item>
<title>(Ruby) How to call JavaScript in the Application Under Test, from Selenium</title>
<link>http://snipplr.com/view/19872/how-to-call-javascript-in-the-application-under-test-from-selenium/</link>
<description><![CDATA[ <p>When writing functional tests with Selenium, it is often convenient to call JavaScript functions and methods, that are part of the Web application you are testing.  After all, Selenium is a functional testing framework for Web UI and most of the exciting bits of Web UI are JS (sorry, all you CSS hackers, but them's the facts). 

The problem is that it's not immediately obvious how you can access the DOM of the Application Under Test (AUT).  Selenium Core (in which all Selenium tests execute) is a frame set, and if you simply try to call your JavaScript with `getEval`, you'll get an error because `getEval` references Selenium Core's DOM, not the DOM of the AUT.

Fortunately the answer is simple.  Use `this.browserbot.getCurrentWindow()` to get a reference to the `window` object in *your* DOM.  Then you can execute any of the JS that lives in your page, right from Selenium!

This example uses the Ruby driver, but the principle is the same regardless of which language you use.</p> ]]></description>
<pubDate>Thu, 17 Sep 2009 13:14:43 GMT</pubDate>
<guid>http://snipplr.com/view/19872/how-to-call-javascript-in-the-application-under-test-from-selenium/</guid>
</item>
<item>
<title>(Ruby) Waiting for events with the Selenium-Client Ruby driver</title>
<link>http://snipplr.com/view/16557/waiting-for-events-with-the-seleniumclient-ruby-driver/</link>
<description><![CDATA[ <p>## List of commonly used `wait_for` commands

For convenience, here are direct links to the documentation of the Selenium-Ruby `wait_for` commands that are most often used.   The [documentation of WaitFor commands in Selenium Core](http://release.seleniumhq.org/selenium-core/1.0.1/reference.html#waitForCondition "WaitForCondition entry in the docs for Selenium Core 1.0.1") may also be of interest.

0. [`wait_for_condition`](http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html#M000088)
0. [`wait_for_element`](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000257)
0. [`wait_for_field_value`](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000261)
0. [`wait_for_frame_to_load`](http://selenium-client.rubyforge.org/classes/Selenium/Client/GeneratedDriver.html#M000221)
0. [`wait_for_no_element`](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000258)
0. [`wait_for_no_field_value `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000262)
0. [`wait_for_no_text `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000260)
0. [`wait_for_page `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html#M000067)
0. [`wait_for_page_to_load `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html#M000068)
0. [`wait_for_popup `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html#M000069)
0. [`wait_for_text `](http://selenium-client.rubyforge.org/classes/Selenium/Client/Extensions.html#M000259)

## Where to find the documentation

More information on`wait_for` with the Ruby client, including a complete list of the `wait_for` commands available in the Ruby client, is to be found in the [documentation for the Selenium-Client Ruby Gem.](http://selenium-client.rubyforge.org/ "selenium-client is the official Ruby driver for Selenium RC")  As Selenium-Client defines many "idiomatic" Ruby aliases for built-in Selenium methods, it will probably be especially helpful to become familiar with the [Selenium Ruby driver command set](http://selenium-client.rubyforge.org/classes/Selenium/Client/GeneratedDriver.html) as well as Selenium-Client's [Idiomatic Ruby command set.](http://selenium-client.rubyforge.org/classes/Selenium/Client/Idiomatic.html)

It may also be helpful to refer to the [documentation for Selenium Core](http://release.seleniumhq.org/selenium-core/1.0.1/reference.html#waitForCondition "WaitForCondition entry in the docs for Selenium Core 1.0.1") with regard to `WaitForCondition` and related commands.  In general the **Selenium Core documentation** tends to provide more insight into how commands work, than does the documentation for any of the drivers.

## Examples

Below are a couple of examples of using Selenium's `wait_for` family of commands with the [Ruby driver (Selenium-Client).](http://rubyforge.org/projects/selenium-client/ "Selenium Client Ruby Gem at RubyForge")

One item of note is that , within `wait_for_condition`, one does *not* need to use `this.browserbot.getCurrentWindow()` to access the DOM of the AUT</p> ]]></description>
<pubDate>Wed, 01 Jul 2009 10:57:06 GMT</pubDate>
<guid>http://snipplr.com/view/16557/waiting-for-events-with-the-seleniumclient-ruby-driver/</guid>
</item>
<item>
<title>(JavaScript) Use a variable in a JavaScript regular expression</title>
<link>http://snipplr.com/view/15357/use-a-variable-in-a-javascript-regular-expression/</link>
<description><![CDATA[ <p>Use the `RegExp` constructor to create the regular expression.  You can pass `RegExp` any string as an argument and it will be converted to a regex.</p> ]]></description>
<pubDate>Wed, 27 May 2009 11:48:31 GMT</pubDate>
<guid>http://snipplr.com/view/15357/use-a-variable-in-a-javascript-regular-expression/</guid>
</item>
<item>
<title>(Ruby) Rendered WGet with Selenium</title>
<link>http://snipplr.com/view/7906/rendered-wget-with-selenium/</link>
<description><![CDATA[ <p>Created in response to a discussion about "ghosting," between Kord Campbell of Splunk and Christian Heilman of Yahoo! at Ajax World 2008.

IMPORTANT: The Selenium-RC server must be running on port 4444 (the default) and you must have Curl and Tidy installed on your system.   

NOTE: Diffing the rendered versus the "server" source.  This option works OK as a learning tool, but I need to do more in terms of normalizing the server source versus the rendered source.  I run both the "server" and innerHTML sources through Tidy, but unfortunately there still seems to be a lot of extraneous differences between them.

So while this works OK for downloading the rendered source via a Ruby script, I've got a ways to go before it can produce a reliable "rendered diff."

keywords: rwget, rwdiff, ruby, selenium rc, selenium remote control, examples</p> ]]></description>
<pubDate>Mon, 18 Aug 2008 09:23:43 GMT</pubDate>
<guid>http://snipplr.com/view/7906/rendered-wget-with-selenium/</guid>
</item>
<item>
<title>(Other) YUI Compressor break before 8000 characters so as not to break ClearCase</title>
<link>http://snipplr.com/view/7819/yui-compressor-break-before-8000-characters-so-as-not-to-break-clearcase/</link>
<description><![CDATA[ <p>Creates a minified version of script_to_minify.js called minified.js.
Breaks minified scripts before 8000 characters.
Should also work on CSS.</p> ]]></description>
<pubDate>Mon, 11 Aug 2008 16:03:02 GMT</pubDate>
<guid>http://snipplr.com/view/7819/yui-compressor-break-before-8000-characters-so-as-not-to-break-clearcase/</guid>
</item>
<item>
<title>(JavaScript) Sort the OPTIONs in a SELECT menu</title>
<link>http://snipplr.com/view/3265/sort-the-options-in-a-select-menu/</link>
<description><![CDATA[ <p>Author: Clyde Ingram</p> ]]></description>
<pubDate>Tue, 10 Jul 2007 15:46:00 GMT</pubDate>
<guid>http://snipplr.com/view/3265/sort-the-options-in-a-select-menu/</guid>
</item>
<item>
<title>(JavaScript) Crockford's object producer</title>
<link>http://snipplr.com/view/3154/crockfords-object-producer/</link>
<description><![CDATA[ <p>Note that this will /not/ work:
var a = {a:1, b:2}
var b = {prototype: a}</p> ]]></description>
<pubDate>Fri, 06 Jul 2007 21:06:54 GMT</pubDate>
<guid>http://snipplr.com/view/3154/crockfords-object-producer/</guid>
</item>
<item>
<title>(Perl) show JPEGs in this directory in a simple HTML gallery</title>
<link>http://snipplr.com/view/3121/show-jpegs-in-this-directory-in-a-simple-html-gallery/</link>
<description><![CDATA[ <p>Creates an HTML page with the first image in the directory in the center.  Forward and Back buttons scroll through all the images in the directory in order.

This is how I lived before Firefox ~.^</p> ]]></description>
<pubDate>Tue, 03 Jul 2007 21:53:26 GMT</pubDate>
<guid>http://snipplr.com/view/3121/show-jpegs-in-this-directory-in-a-simple-html-gallery/</guid>
</item>
<item>
<title>(JavaScript) Summarize Web page bookmarklet</title>
<link>http://snipplr.com/view/2573/summarize-web-page-bookmarklet/</link>
<description><![CDATA[ <p>Grabs the URL, TITLE, and selected text (if any) from the current page.  Then makes a new window with a TEXTAREA and pastes the text into the new window.

This version was designed to work with a client's Jira installation, so it filters the identifying string off the end of titles.  

In practice this bookmarklet will work on any Web page.</p> ]]></description>
<pubDate>Tue, 01 May 2007 19:18:50 GMT</pubDate>
<guid>http://snipplr.com/view/2573/summarize-web-page-bookmarklet/</guid>
</item>
<item>
<title>(HTML) Reusable Box with Images and CSS (implements a non-semantic variant of Sliding Doors)</title>
<link>http://snipplr.com/view/2439/reusable-box-with-images-and-css-implements-a-nonsemantic-variant-of-sliding-doors/</link>
<description><![CDATA[ <p>Reusable balloon, built with JavaScript and css.  Expands horizontally (set in the CSS) and vertically (automatically) up the size of its component images.  This solution is not semantic, but it is flexible.

The goal was to implement a variant of Sliding Doors that could be boiled down to two snippets of code (one before the content container, and one after) and some CSS.

Expects 3 images, examples of which can be found here: http://onemorebug.com/meme.washer/code_examples/reusableBox/images

Also includes an example JavaScript implementation.</p> ]]></description>
<pubDate>Sat, 07 Apr 2007 09:47:05 GMT</pubDate>
<guid>http://snipplr.com/view/2439/reusable-box-with-images-and-css-implements-a-nonsemantic-variant-of-sliding-doors/</guid>
</item>
</channel>
</rss>
