<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Selenium Testing? Do Cross Browser Testing with Sauce Labs &#187; selenium rc</title>
	<atom:link href="http://saucelabs.com/blog/index.php/tag/selenium-rc/feed/" rel="self" type="application/rss+xml" />
	<link>http://saucelabs.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 10 May 2012 17:20:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How To Minimize The Pain Of Locator Breakage</title>
		<link>http://saucelabs.com/blog/index.php/2010/09/how-to-minimize-the-pain-of-locator-breakage/</link>
		<comments>http://saucelabs.com/blog/index.php/2010/09/how-to-minimize-the-pain-of-locator-breakage/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 22:24:25 +0000</pubDate>
		<dc:creator>Adam Goucher</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Selenium Knowledge]]></category>
		<category><![CDATA[Locators]]></category>
		<category><![CDATA[selenium ide]]></category>
		<category><![CDATA[selenium rc]]></category>
		<category><![CDATA[selenium tips]]></category>

		<guid isPermaLink="false">http://saucelabs.com/blog/?p=1908</guid>
		<description><![CDATA[In the Agile world, a common saying is &#8216;never break the build.&#8217; But this thought can actually hinder agility if taken too literally. Sometimes, you want the build to break, as that means things are changing and progressing. A better phrase is &#8216;don&#8217;t leave the build broken&#8217;. The same could be said for Selenium and [...]]]></description>
			<content:encoded><![CDATA[<p>In the Agile world, a common saying is &#8216;never break the build.&#8217; But this thought can actually hinder agility if taken too literally. Sometimes, you want the build to break, as that means things are changing and progressing. </p>
<p>A better phrase is &#8216;don&#8217;t leave the build broken&#8217;. The same could be said for Selenium and element locators. They will break, and we want them to&#8230;periodically. The measures that count are:</p>
<ul>
<li>How long it takes to go from broken to fixed &#8211; this should be small; really, really small</li>
<li>How big is the change to fix them &#8211; ideally, only one line per element. Total. Throughout the whole code base.</li>
</ul>
<p>So how do we go about fixing these intermittent breakages?</p>
<p>The easiest locator to use is &#8216;id.&#8217; To be most successful with this strategy, a static id attribute is put on each html element being interacted with. And since we don&#8217;t know what elements will be needed to automate in the future, it&#8217;s best to put an id on every element. The scripts will always know how to find the elements on the page uniquely, as WSC standards require that ids be unique in a single page.</p>
<p>While this solves the html structure change problems that often come from using XPath and CSS selectors by finding elements independently of their position, it still doesn&#8217;t solve id change issues. Solving that requires discipline and communication among the development and automation teams. One geographically dispersed team I worked with created the following two-part policy for this.</p>
<ol>
<li>Anyone can add an id to an element that does not have one</li>
<li>If you change an id, the change must be communicated to <em>both</em> the dev and automation teams</li>
</ol>
<p>Of course, knowing about a change is a bitter pill to swallow when it involves updating hundreds of scripts. A better solution is to separate the locator definitions from the main test code.</p>
<p><strong>Selenium IDE</strong></p>
<p>Separation of scripts from locators is achievable in Selenium IDE through the use of user-extensions. A previous <a href="http://saucelabs.com">Sauce Labs</a> blog post, <a href="http://saucelabs.com/blog/index.php/2010/03/selenium-tip-of-the-week-parametrizing-selenese-tests/">Parametrizing Selenese tests</a>, explains how to make use of these extensions, but rather than provide the &#8216;Value&#8217; column, the &#8216;Target&#8217; is what could [should] be provided by the user-extension.</p>
<pre class="brush:javascript">storedVars["registrationFirstname"] = "first";
storedVars["registrationLastname"] = "last";
storedVars["registrationSubmit"] = "register";</pre>
<p>A script that interacts with a registration form might look like:</p>
<table>
<tbody>
<tr>
<td>open</td>
<td>/registration</td>
</tr>
<tr>
<td>type</td>
<td>${registrationFirstname}</td>
<td>fred</td>
</tr>
<tr>
<td>type</td>
<td>${registrationFirstname}</td>
<td>flintstone</td>
</tr>
<tr>
<td>click</td>
<td>${registrationSubmit}</td>
</tr>
</tbody>
</table>
<p>Going back and updating Selenese scripts is a pain, but using user-extensions to provide the locators to your scripts makes it as simple as updating an external JS file.</p>
<p><strong>Selenium RC</strong></p>
<p>Most Selenium RC languages have a way of reading run-time properties from external files in some native manner:</p>
<ul>
<li>Java &#8211; Properties</li>
<li>Python &#8211; ConfigParser or maybe just python dictionaries</li>
<li>Ruby &#8211; YAML</li>
<li>C# &#8211; App.Config</li>
</ul>
<p>If you&#8217;re writing your scripts in Java, you should create a locators.properties file, which would include something along the lines of:</p>
<pre class="brush:text"># uses the id locator
registration.firstname=firstname
# xpath
registration.lastname=//form[@name='lastname']/input[@type='text'][2]
# css
registration.submit=css=form submit</pre>
<p>Here is a Java class that interacts with our very simplistic registration form, and uses the external properties file (above) for its locators.</p>
<pre class="brush:java">import java.io.InputStream;
import java.util.Properties;

import org.junit.Before;
import org.junit.Test;
import org.junit.After;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class TestRegistration.
{
    private Selenium selenium;
    public static Properties locators = new Properties();

    @Before
    public void setUp() throws Exception
    {
        InputStream is = TestRegistration.class.getResourceAsStream("/locators.properties");
        locators.load(is);

        selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:3000");
        selenium.start();
        selenium.setTimeout("90000");
        selenium.windowMaximize();
    }

    @Test
    public void testVisibleElement() throws Exception
    {
        selenium.open("/registration");
        selenium.waitForPageToLoad("30000");
        selenium.type(locators.getProperty("registration.firstname"), "fred");
        selenium.type(locators.getProperty("registration.lastname"), "flintstone");
        selenium.click(locators.getProperty("registration.firstname");
        selenium.waitForPageToLoad("30000");
    }

    @After
    public void tearDown() throws Exception
    {
        selenium.stop();
    }
}</pre>
<p>Notice there are no hardcoded locator strings in the test, so we can change locators without changing the script. And if a consistent, well-thought-out naming convention is used for the property names, it CAN actually increase the readability of the scripts.</p>
<p>By using the same locators.properties throughout the whole suite of scripts, a single change will cascade to all scripts. It also means that as ids become available on elements that didn&#8217;t have them previously, they can quickly be replaced with more structurally dependent methods, such as XPath and CSS. A further benefit is that, by quickly scanning the file, one can determine where in the suite XPath is still being used; <a href="http://saucelabs.com/blog/index.php/2009/10/selenium-tip-of-the-week-start-improving-your-locators/">converting from XPath to CSS</a> is currently a recommended practice for performance reasons.</p>
<p><strong>Page Objects</strong></p>
<p>Page Objects are a way of representing a web page as a class (or number of classes) to bring Object Oriented techniques and patterns to Selenium. Most Page Object patterns have the locators abstracted out of the actual Page Objects and into a higher level parent class. But even then, those locators should be loaded from an external mechanism to allow for locator changes without recompilation.</p>
<p>Page Objects are beyond the scope of this article, but for an introduction and a sample implementation pattern of them in Python, see <a href="http://www.pragprog.com/magazines/2010-08/page-objects-in-python">Page Objects in Python &#8211; Automating Page Checking without Brittleness</a>.</p>
<p><strong>Next Steps</strong></p>
<p>Separating scripts from the locators being used is an important step towards reducing the amount of time teams invest in keeping their automation running. Too often, though, teams jump on this idea and invest valuable time converting their whole suite, which sets them further behind what the features development is producing. A better solution for the team is to collectively decide that scripts and locators will be separate, and from then on, only create scripts in this model, and only backport the abstraction of locator string when they break in existing code. The scripts will be &#8216;hybrid&#8217; for a time, but ultimately it&#8217;s a much faster approach.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsaucelabs.com%2Fblog%2Findex.php%2F2010%2F09%2Fhow-to-minimize-the-pain-of-locator-breakage%2F&amp;title=How%20To%20Minimize%20The%20Pain%20Of%20Locator%20Breakage" id="wpa2a_2"><img src="http://saucelabs.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://saucelabs.com/blog/index.php/2010/09/how-to-minimize-the-pain-of-locator-breakage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Release of Sauce RC (Sauce Labs&#8217; enhanced / extended Selenium RC)</title>
		<link>http://saucelabs.com/blog/index.php/2010/05/new-release-of-sauce-rc-sauce-labs-enhanced-extended-selenium-rc/</link>
		<comments>http://saucelabs.com/blog/index.php/2010/05/new-release-of-sauce-rc-sauce-labs-enhanced-extended-selenium-rc/#comments</comments>
		<pubDate>Thu, 13 May 2010 21:40:32 +0000</pubDate>
		<dc:creator>The Sauce Labs Team</dc:creator>
				<category><![CDATA[Sauce Offerings]]></category>
		<category><![CDATA[sauce rc]]></category>
		<category><![CDATA[selenium rc]]></category>

		<guid isPermaLink="false">http://saucelabs.com/blog/?p=1020</guid>
		<description><![CDATA[We&#8217;re pleased to announce the release of a greatly improved version of Sauce RC that incorporates excellent user feedback and addresses the most significant bugs in the earlier version (Mac release is coming soon). Here is a partial list of changes: Experimental HTMLSuite support for local Selenium RC mode OnDemand mode loggging Log highlight More [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re pleased to announce the release of a greatly improved version of <a href="http://saucelabs.com/downloads">Sauce RC</a> that incorporates excellent user feedback and addresses the most significant bugs in the earlier version (Mac release is coming soon).</p>
<p>Here is a partial list of changes:</p>
<ul>
<li>Experimental HTMLSuite support for local Selenium RC mode</li>
<li>OnDemand mode loggging</li>
<li>Log highlight</li>
<li>More efficient log retrieving</li>
<li>Improved preferences validation</li>
<li>Upgrade to jquery 1.4.2 and jquery UI 1.8</li>
<li>More stable web server (<a href="http://www.cherrypy.org/">CherryPy</a> based)</li>
<li>Ensure clean uninstall</li>
<li>Many bug fixes.</li>
</ul>
<p>And here&#8217;s a video, recorded by our very own robots using Selenium and Sauce OnDemand:<br />
<script src="/flowplayer/example/flowplayer-3.1.4.min.js" type="text/javascript"></script></p>
<div style="display:block;width:600px;height:450px" id="player"></div>
<p>        <script> 
            flowplayer("player", "/flowplayer/flowplayer-3.1.5.swf", { 
                clip:  {
                    url:'/jobs/ef6d35aba343a9e34bcd8226f65fd09d/video.flv',
                    provider: 'streamer', 
                    autoPlay: false,
                    autoBuffering: true,
                },
                plugins: { 
                    streamer: { 
                        url: '/flowplayer/flowplayer.pseudostreaming-3.1.3.swf', 
                        //queryString: escape('?start=${start}') 
                    } 
                }  
            });
        </script> </p>
<p>Using our <strong>new public job feature</strong>*, we can share the video and you can even see the full <a title="Sauce RC Demo video" href="https://saucelabs.com/jobs/ef6d35aba343a9e34bcd8226f65fd09d">job results page</a> for the test that recorded the video. Feel free to tweet and share with anyone!</p>
<p>* Go to any of your jobs and above the video, you will find a &#8220;Make Public&#8221; link ;)</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsaucelabs.com%2Fblog%2Findex.php%2F2010%2F05%2Fnew-release-of-sauce-rc-sauce-labs-enhanced-extended-selenium-rc%2F&amp;title=New%20Release%20of%20Sauce%20RC%20%28Sauce%20Labs%26%238217%3B%20enhanced%20%2F%20extended%20Selenium%20RC%29" id="wpa2a_4"><img src="http://saucelabs.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://saucelabs.com/blog/index.php/2010/05/new-release-of-sauce-rc-sauce-labs-enhanced-extended-selenium-rc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zero day Firefox 3.6 support in Sauce RC, Selenium RC</title>
		<link>http://saucelabs.com/blog/index.php/2010/01/zero-day-firefox-3-6-support-in-sauce-rc-selenium-rc/</link>
		<comments>http://saucelabs.com/blog/index.php/2010/01/zero-day-firefox-3-6-support-in-sauce-rc-selenium-rc/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 01:23:49 +0000</pubDate>
		<dc:creator>The Sauce Labs Team</dc:creator>
				<category><![CDATA[Sauce Offerings]]></category>
		<category><![CDATA[Selenium Knowledge]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[sauce rc]]></category>
		<category><![CDATA[selenium rc]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://saucelabs.com/blog/?p=450</guid>
		<description><![CDATA[Today Sauce Labs released a new version of Sauce RC supporting Firefox 3.6, which was released by Mozilla this morning. Sauce Labs also sponsored work on Selenium RC to support Firefox 3.6. In under 12 hours, Sauce RC has added support for a brand new browser, allowing customers to keep their websites on the cutting [...]]]></description>
			<content:encoded><![CDATA[<p>Today Sauce Labs released a new version of <a href=http://saucelabs.com/products/downloads>Sauce RC</a> supporting Firefox 3.6, which was released by Mozilla this morning. Sauce Labs also sponsored work on Selenium RC to support Firefox 3.6. In under 12 hours, Sauce RC has added support for a brand new browser, allowing customers to keep their websites on the cutting edge of browser support.</p>
<p><a href=http://saucelabs.com/products/downloads>Sauce RC</a> is Sauce Labs&#8217; commercially supported version of Selenium RC that includes simplified install and administration. Sauce RC is backed by a dedicated team of engineers to ensure bugs are fixed promptly and new browsers are supported.</p>
<p>Congratulations and thanks to <a href="http://adam.goucher.ca/" target="_blank">Adam Goucher</a> for his effort in making this happen in record time.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsaucelabs.com%2Fblog%2Findex.php%2F2010%2F01%2Fzero-day-firefox-3-6-support-in-sauce-rc-selenium-rc%2F&amp;title=Zero%20day%20Firefox%203.6%20support%20in%20Sauce%20RC%2C%20Selenium%20RC" id="wpa2a_6"><img src="http://saucelabs.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://saucelabs.com/blog/index.php/2010/01/zero-day-firefox-3-6-support-in-sauce-rc-selenium-rc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sauce RC Released for Mac.  Marks first-ever fully functional Selenium RC on Snow Leopard.</title>
		<link>http://saucelabs.com/blog/index.php/2009/12/sauce-rc-supports-selenium-rc-on-mac-osx-snow-leopard/</link>
		<comments>http://saucelabs.com/blog/index.php/2009/12/sauce-rc-supports-selenium-rc-on-mac-osx-snow-leopard/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:55:59 +0000</pubDate>
		<dc:creator>John Dunham</dc:creator>
				<category><![CDATA[Sauce Offerings]]></category>
		<category><![CDATA[sauce rc]]></category>
		<category><![CDATA[selenium rc]]></category>

		<guid isPermaLink="false">http://saucelabs.com/blog/?p=237</guid>
		<description><![CDATA[Today Sauce Labs released Sauce RC for Mac. You can download it here.  Sauce RC is Sauce Labs&#8217; certified, enhanced and commercially-supported version of Selenium RC. This is big news for several reasons: For the first time ever, Mac OS X Snow Leopard users can use Selenium RC, the underlying technology in Sauce RC, on [...]]]></description>
			<content:encoded><![CDATA[<p>Today Sauce Labs released Sauce RC for Mac.  You can download it <a href="http://saucelabs.com/products/sauce-rc">here</a>.  Sauce RC is Sauce Labs&#8217; certified, enhanced and commercially-supported version of Selenium RC.</p>
<p>This is big news for several reasons:</p>
<ul>
<li>For the first time ever, Mac OS X Snow Leopard users can use Selenium RC, the underlying technology in Sauce RC, on the full range of supported browsers</li>
<li>Google <a href="http://digitaldaily.allthingsd.com/20091208/google-announces-chrome-beta-for-mac/?mod=ATD_sphere">Chrome Beta was released for Mac</a> OS X yesterday;  Sauce Labs is shipping Sauce RC support for Google Chrome Beta today.</li>
<li>Sauce RC brings the same easy-to-install, easy-to-operate benefits to the Mac that Windows Sauce RC users already enjoy.</li>
</ul>
<p>And of course <a href="http://saucelabs.com/products/sauce-rc">Sauce RC is available for Windows</a>.  Both Sauce RC versions can be used with Sauce Labs&#8217; <a href="http://saucelabs.com/products/sauce-ondemand">Sauce OnDemand</a> cloud-hosted Selenium service.  The combination makes it unprecedentedly easy to use Selenium RC and get immediate access to cross-browser testing on ten (10) popular browsers, including Google Chrome.</p>
<p>Here&#8217;s a brief screencast showing how incredibly easy it is to install and use Sauce RC:</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="370" id="viddler_1f1efee1"><param name="movie" value="http://www.viddler.com/player/1f1efee1/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/1f1efee1/" width="437" height="370" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_1f1efee1"></embed></object></p>
<p>Sauce Labs will open the code for Sauce RC following the beta period.  Users interested in the Sauce RC open source release should follow this blog or follow <a href="http://twitter.com/saucelabs">@saucelabs</a> on Twitter.</p>
<p><a href="http://saucelabs.com/products/sauce-rc">Download Sauce RC for Mac</a>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsaucelabs.com%2Fblog%2Findex.php%2F2009%2F12%2Fsauce-rc-supports-selenium-rc-on-mac-osx-snow-leopard%2F&amp;title=Sauce%20RC%20Released%20for%20Mac.%20%20Marks%20first-ever%20fully%20functional%20Selenium%20RC%20on%20Snow%20Leopard." id="wpa2a_8"><img src="http://saucelabs.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://saucelabs.com/blog/index.php/2009/12/sauce-rc-supports-selenium-rc-on-mac-osx-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

