Selenium 2.0 beta 1 Release

We recently released the first of the betas for Selenium 2.

We recently released the first of the betas for Selenium 2. It’s available for Java, C# and Ruby. If you’ve been holding off trying Selenium 2 because of the alpha label, then the biggest improvement you’ll see is with the new WebDriver APIs, but there’s a lot more!

Of course, we’d love this release to be completely bug free, but this is, after all, a beta, so there are some known issues:

  • The selenium 1.x emulation using IE is a little flaky.
  • The ChromeDriver is not as capable as the others.
  • Anything in our bug list.

You can download it from here:

http://code.google.com/p/selenium/downloads/list

You can read the javadocs and the ruby docs.

An obvious question is “When will the beta end?” The short answer is when we’ve implemented the alerts and prompts and advanced user interactions APIs in all supported browsers. We expect there to be some flex in some APIs (removing deprecated methods, and within the advanced user interactions API) but what you have here is basically what you’re going to get when we hit 2.0 final. I have no idea how long this will take, but if you’re interested in helping out, let us know!

Thanks are due to all the committers who have worked so hard to get this code into shape. Thanks are also due to all the people who have taken the time to file bugs, ask for features and participated on the mailing lists. Thank you to you too, for going out and trying this new beta of Selenium 2.

You rock. 🙂

Atoms have come to Selenium IDE

As mentioned in Simon’s Going Atomic: Why? and Going Atomic: How, part of the merging of Selenium and WebDriver is to share common code between the two.

As mentioned in Simon’s Going Atomic: Why? and Going Atomic: How, part of the merging of Selenium and WebDriver is to share common code between the two. And as of the 1.0.10 release of Selenium IDE, this merged code, ‘atoms’ is now included.

Some early users of this release are noticing that this the atom that drives assertAttribute and verifyAttribute is causing their scripts to break. This post explains the ‘why’ and suggests how to fix them as well.

The HTML spec has the notion of a boolean attribute which is one that does something just by being there rather than by its value; checked and selected are two such examples of this. Optionally, you could give these boolean attributes a value that is the same as their name (checked=”checked”) and your page would still validate, but really, the browsers only care that the attribute exist.

Prior to 1.0.10, it was not uncommon for people to do something like

  assertAttribute | checkbox@checked | checked

which fetches the value of the checked attribute on the checkbox with the id or name of checkbox and fails the script is the value is not checked.

In 1.0.10 though, that will fail even if it is checked. This is because checked is a boolean attribute and will now return either true or throw an exception saying the attribute doesn’t exist. Redoing the above step check that the boolean attribute is set results in:

  assertAttribute | checkbox@checked | true

Thankfully, most of the real-world interaction with boolean attributes is focused on checked, disabled, hidden and selected and in these cases using assertAttribute is not really the right thing to do. Instead, the Selenium API provides wrappers for you to use.

checkedassertChecked(locator), assertNotChecked(locator), verifyChecked(locator), verifyNotChecked(locator)
disabledassertEditable(locator), assertNotEditable(locator), verifyEditable(locator), verifyNotEditable(locator)
hiddenassertVisible(locator), assertNotVisible(locator), verifyVisible(locator), verifyNotVisible(locator)
selectedassertSelected*(locator, pattern), assertNotSelected*(locator, pattern), verifySelected*(locator, pattern), verifyNotSelected*(locator, pattern)

Checking for the absence of a boolean attribute that doesn’t have a nice wrapper is a bit of a pain though. In this example I am checking that the boolean attribute multiple is not on the select element with the name elephants.

  assertEval | this.browserbot.findElement("css=select[name=elephants]").getAttribute("multiple"); | null

If you find yourself doing this very often, I suggest you wrap it up in a user-extension inside a plugin as something like

  assertBooleanAttribute | css=select[name=elephants]@multiple | false
  assertBooleanAttribute | css=select[name=elephants]@multiple | true

Hopefully this addresses some of the eventual ‘why the heck did my script break!?!?!’ problems that will no double crop up once Selenium IDE 1.0.10 gets wider distribution.

A Smattering of Selenium #35

(If I wasn’t still recovering from a cold there would be something witty here.)

(If I wasn’t still recovering from a cold there would be something witty here.)

Selenium Conference Survey

Great news! Thanks to the initiative of our friends at Sauce Labs, we’re finally ready to host the first-ever Selenium Conference.

Great news! Thanks to the initiative of our friends at Sauce Labs, we’re finally ready to host the first-ever Selenium Conference. We’re still working out a lot of the details, but so far we’ve decided this first conference will be sometime in April and hosted in San Francisco.

In order to figure out the rest of the details, we’re looking for feedback from the Selenium user community. Please take a moment to fill out the following survey. Your answers will help us properly plan the best possible conference.

http://bit.ly/fn8YyS

Thanks!

A Smattering of Selenium #34

We’ll start this week with the official announcement of ‘Selenium 1.0 Testing Tools: Beginner’s Guide’ being available.

We’ll start this week with the official announcement of ‘Selenium 1.0 Testing Tools: Beginner’s Guide’ being available. Congrats David! (Still waiting for my copy…)

Oh. and I just noticed that this is the Selenium-iversay edition of these things.

A Smattering of Selenium #33

…and here’s the links!

…and here’s the links!

A Smattering of Selenium #32

For those people paying attention to the goings-on in the Selenium world, yes, I am skipping something major until some of the details are worked out and announced.

For those people paying attention to the goings-on in the Selenium world, yes, I am skipping something major until some of the details are worked out and announced. Until then, here are the links I accrued over the week.

  • Selenium uses Bamboo for its CI infrastructure. This week saw an upgrade to the latest version so if you want bleeding-edge code, get it here
  • The only browser Se has no real traction on right now is the BlackBerry one. But if someone wanted to tackle it, here is a post from Atomic Object on their BlackBerry development environment that would help kickstart things maybe.
  • Under the category of ‘let the language deal with things’ is html5lib for python and php which will parse html. Sometimes it is far faster to dump your attribute checks etc. to a native parser than let Se do it.
  • Scott Sims has released Selenium Fury upon the Ruby world. Think of it as a Page Factory implementation for Ruby.
  • Using Se-IDE and Easyb? Here is a thread on how to use the generated code without modification
  • JRuby is one of the better languages to use to write Se scripts in, and here are videos from JRubyConf 2010
  • Cheezy is writing a series on UI tests. So far there is How do we keep them from being brittle? and Part Two
  • Se2 for JS? Sure, why not. webdriver-js
  • Jari release the selenium-webdriver 0.1.0 gem this week. Why the big jump from 0.0.29 to 0.1.0? We’ve merged in the selenium-client gem into the main selenium codebase and now there is a single gem if you want to do 1.x or 2.x scripting.
  • Google Refine is just darn cool. I’m not really sure how it plays into automation, but I get the sneaky suspicion it could. Somehow.
  • The YUI Test has Se built right in.

A Smattering of Selenium #31

The big news for last week was that I released Se-IDE 1.0.8 to very little fanfare.

The big news for last week was that I released Se-IDE 1.0.8 to very little fanfare. 1.0.9 should be a week or two and much more important a release.

  • Cheesecake! is isn’t nearly as impractical as Pacman, but still adds to the Se2 example bucket.
  • The London Se Meetup stuff from last week are starting to appear…
  • Some notes from CITCON last week as well. Seems like London was the place to be.
  • When designing automation frameworks (internal or external), the list of ways to make it hard to misuse should be kept in the back of your mind.
  • Of course your automation is under version control, right? RIGHT?!? What the Commit is rather amusing, if not a scathing satire. (hint: hit refresh)
  • Sauce Labs announced the availability of a CI API. But there is nothing to say that you couldn’t integrate their alternative annotation methods outside of CI too.
  • Harry Robinson did a session at CAST 2010 on ‘Exploratory Test Automation’ (which I missed; no, not bitter at all..) and I found his slides
  • If you are using the hosted Bamboo solution and most of your Se tests need windows, then here are instructions on how to create your own custom elastic agent image
  • Here is something fun, do you Hate or Love Se?
  • Slate seems like an interesting module for Python folks since it can parse and extract information from PDFs which is often a black hole in automation.
  • I continue to maintain that automation is programming (much to the annoyance of the classical black-box tester who is starting out with it) and that perhaps the easiest language to start learning is Python. Learn Python The Hard Way is a new book which looks like an ideal way to learn the language. I haven’t really gone through it to see which parts are more (or less) relevant to automation, but…
  • You’re cuking it wrong has lots of tips on how to write Cucumber scripts well.

A Smattering of Selenium #30

I’ve missed a couple weeks due to travel and a complete system lock which meant I lost all the links I had open but not saved.

I’ve missed a couple weeks due to travel and a complete system lock which meant I lost all the links I had open but not saved. So these are the ones I have recovered.

Oh, and both 2.0a6 and 2.0a7 have been released. We’re getting closer to the ‘API freeze’ which will mark the end of ‘alpha’ and the start of bug fixing (beta) for the final release.

Selenium 2.0a6 Released

We are extremely pleased to announce the release of Selenium 2.0a6!

We are extremely pleased to announce the release of Selenium 2.0a6! Head over to the downloads page to get it while it’s hot, or wait just a little bit longer for it to appear in a maven repo near you. The .Net version will also be updated soon too, and the python and ruby libraries have been having smaller, more frequent releases all this time.

You’ll be pleased to hear that the Selenium 1.0 APIs have remained constant, so what’s changed? Here, in no particular order are the major changes you’ll find in 2.0a6:

  • Android support: you can now download the APK and run webdriver tests using Android 1.6 to 2.2.
  • Firefox 4 support.
  • Experimental IE9 support
  • New APIs for dealing with HTML5 elements (best implemented, for now, by the mobile webdrivers)
  • A richer .Net API
  • A move to Sizzle for locating elements using CSS in browsers that don’t have a native API for that.
  • Far better support for running your existing Selenium RC tests using WebDriver, helping you make a managed migration to the newer APIs.

There are also lots of nice touches for the more technically inclined, including the ability to re-use instances of FirefoxProfiles, better configurability when requesting a remote webdriver instance, better resource management and more shared code between the Selenium and WebDriver implementations.

Thank you to everyone who has taken the time to report a bug on our issue tracker, or raised problems on one of our mailing lists, or shown up for some of the banter on the IRC channel: without your involvement, the project wouldn’t be half as much fun, and wouldn’t be as capable as it is. Thanks are also due to the development team, who have poured an enormous amount of work into this release (538 revisions in under 90 days, or about 6 check-ins each and every day)

Hope you like it!

A Smattering of Selenium #29

A fair number of links this week. The vast majority of which were buried in annoying airport internet advertising frames…

A fair number of links this week. The vast majority of which were buried in annoying airport internet advertising frames…

A Smattering of Selenium #28

So we go from not-enough-stuff-to-do-one to wow-this-will-take-awhile.

So we go from not-enough-stuff-to-do-one to wow-this-will-take-awhile. And we’re off..

  • Tellurium is one of the many frameworks that absorb Se and has an article on InfoQ called Introducing the Tellurium Automated Testing Framework which, well, introduces the framework.
  • In the first of many Cucumber related posts this week is Sean Grove’s Cucumber Sauce for doing parallel Cucumber runs on the Sauce infrastructure. Might be general enough to use outside of it as well.
  • Cuke4Ninja: The Secret Ninja Cucumber Scrolls, aside from outstanding ninja cucumber images, has a dead-tree book’s work of getting starting with Cucumber information.
  • I updated the list of plugins for Se-IDE (that I know of) on the Se-HQ download page
  • Arquillian is testing framework, developed at JBoss.org, that empowers developers to write integration tests for business objects that are executed inside of an embedded or remote container–options include a servlet container, a Java EE application server or a Java SE CDI environment. Oh, and it has a Selenium (1.x RC and 2.x Se WebDriver) extensions
  • The Fall 2010 issue of Methods & Tools has an article on Bromine
  • Another piece of Cucumber news is a Skills Matter video of Gojko Adzic and David de Florinier (see Cuke4Ninja able) talking about Cucumber & Selenium 2.0
  • If you are doing automation, the right place to be running it is not the IDE but a CI server. Well, perhaps in addition to the IDE… Anyways, here is a post on Setting up a python CI server with Hudson. Now there is no excuse Python kids…
  • Parallel Testing should be this year’s automation theme. Here is how to do it in C#.
  • …and in PHP (this one, again with a bent to Sauce OnDemand, but…)
  • And yet another PHP Sauce integration.
  • Selenate is a JS 1.6 runner for Se
  • Actionscript Javascript Communication actually shows how the whole ExternalInterface stuff works when talking into Flash/Flex from within Se. I could have used this a year ago…
  • Aside from parallel stuff, I think the Decorators and their kin are nice additions to the automation toolkit. Here is one for taking screenshots on test failure in Python
  • London is having another meetup on November 3
  • The fall 2010 issue of Automated Software Testing Magazine is out. I think its kinda sad that articles on dynamic data generation still need to be written, but the ‘Testing With Reflection’ article seems to be not bad in that the message is ‘automate to learn, not to test’

A Smattering of Selenium #27

Seems I skipped a week, but that’s okay since there hasn’t been much in terms of volume…

Seems I skipped a week, but that’s okay since there hasn’t been much in terms of volume (or maybe my clever search filter is a bit overly clever…).

  • The big news I think is that there is now a Se driver for Node.js called Soda. I’m not sure I like the syntax, but I also don’t claim to know Node so it could be idiomatically correct which is more important than my blessing.
  • Hot on the heels of the Soda announcement was the announcement that it has built-in support for Sauce Labs’ OnDemand Se-in-the-cloud service
  • TestNG is often the java runner of choice for Se (for its built-in parallelization stuff) and it now has a Selenium page right in the official documentation.
  • Drupal sites have long used Se to automate maintenance tasks and such, but now there is Drunit which hopes to replace SimpleTest as the way to use PHPUnit and Se-RC in the Drupal community.
  • The August SFSE meetup was more of a crowd-sourced content affair with participants voting up questions that they wanted to hear Se inventor Jason Huggins answer. It then turned into a crowd-sourced answer affair with Simon Stewart (Se-WebDriver), Kevin Menard (Se-Grid) and myself (Se-IDE and general opinionated tester) getting dragged in periodically. The video is now online for your viewing enjoyment.
  • I’ll be writing about this more this week I’m sure, but Tracking Selenium Commands Using C# and SQL Server 2008 has actually made me rethink my position on what reporting should be coming out of your automation run. No mean feat that.
  • Three Keys to Automation is an old article from Bret Pettichord (he of WATIR fame) that somehow crossed my path this week but is as relevant today as it was 10 years ago
  • SMW System Testing with Selenium is a wiki page (unsurprisingly) about testing the Semantic MediaWiki with Se including slides from a talk on it. Good to see the world domination plans of becoming the default testing framework on projects progressing so nicely.
  • Testers, Orgs, and the demand for Java jobs nicely echos what I say when I am out at clients who are starting out with Se (or automation in general) – Testers don’t need to know how to write the code for your product, but they need to know how to best automate their tools and tests which will require understanding and comfort with code.. Also just as important from a product perspective is Let’s get rid of the titles of ‘developer’ and ‘tester.’.
  • Not related to Se directly is Dancer which is the Perl equivalent of Ruby On Rails. If you need a quick site for proof-of-concept or experimentation with Se, this might be the framework for you.
  • For the PHP readers, I present a discussion on integrating Se with Behat

A Smattering of Selenium #26

It’s Labour Day here, so this post was written to backdrop of Sponge Bob.

It’s Labour Day here, so this post was written to backdrop of Sponge Bob. In case you were wondering.

Going Atomic: How

This is the second of my technical posts. Again, if you’re interested in the internal workings of Selenium 2, then please skip straight to something else.

This is the second of my technical posts. Again, if you’re interested in the internal workings of Selenium 2, then please skip straight to something else. If you’re interested in how and why we made some of the technical decisions on the project, keep reading….

We left our intrepid heroes in a tight spot: they’d decided to write a shared library of code, to be used by the various webdriver implementations and selenium core, but the requirements for doing this seemed to be at odds with it actually happening.

Fortunately, at about the same time we started down this path, Google Open Sourced the Closure compiler. This is a Javascript compiler that takes as input a set of Javascript files, and which outputs Javascript. It can be configured to either pass the code through untouched into a single file, or it can compile a script aggressively, removing unused code-paths and minifying the output as much as possible. The Closure compiler is used on a lot of Google products, so we know that it’s reliable and consistent.

In order to get the best out of the Closure compiler, we’re writing the atoms using the Closure library. This isn’t as well known as some of the other JS libraries out there, but it’s solid, well tested and is being actively developed. It also features an easy-to-use extension of JsUnit, which makes writing tests a far simpler task than might otherwise be the case, and it has an easy to use mechanism for modularizing code.

So, given that we could compile a single Javascript function (and it’s dependencies) into a minified fragment of JS, we were all set, right? Not quite.

The problem is that the atoms are being extracted from two frameworks that have a different way of viewing the world. As an example, Selenium 1’s “getAttribute” method only returns the value of a particular attribute, whereas WebDriver’s “getAttribute” method will return the value of either a property or an attribute (because sometimes it’s hard to remember whether something is an attribute or a property of an element)

As with all problems in computer science, an extra level of indirection is used to solve this issue.

We’re busy implementing the expected behaviour of both WebDriver’s and Selenium’s API on top of the atoms.

There is, of course, the obvious question about how we get this carefully compressed JS into a driver. One option would be to include the raw Javascript as files in each language binding, and pull them in as required. That’s possible, but it would make each language binding bloated, and would introduce a lot of duplication. The alternative is to push the atoms as far into the driver as possible, and this is what we do. As part of the build process for webdriver, we take the compressed JS and convert it into a form that can be consumed by a particular driver. For example, for the IE driver, we convert them into constants in a C header file. These constants can then be referred to by the driver and converted back into a script than be executed via the same mechanism that is used by “executeScript”.

What do we gain from this seemingly baroque approach? Other than the ability to share the same code between drivers? Many things. The cost of maintenance drops dramatically as we can fix a bug in one place and have that fix be picked up by every driver. Because we’re working in pure JS and just querying the DOM, we can run the unit tests in a browser whilst we’re developing the code. This leads to a very tight feedback cycle. It also makes it easier for developers not familiar with the code to take a look at how we do things, and send us patches (always appreciated!) Finally, we can ensure a consistency of result.

Right, any questions?

A Smattering of Selenium #25

A day late, but that sort of thing happens when you have family.

A day late, but that sort of thing happens when you have family.

A Smattering of Selenium #24

A bit late, but I’m in California for a Selenium Developers Meetup and my body doesn’t quite know where it is temporally.

A bit late, but I’m in California for a Selenium Developers Meetup and my body doesn’t quite know where it is temporally.

A Smattering of Selenium #23

I was at Agile 2010 in Orlando last week so missed doing the Smattering, so here is two weeks worth of links.

I was at Agile 2010 in Orlando last week so missed doing the Smattering, so here is two weeks worth of links.

Going Atomic: Why?

This is the first in a series of technical posts by me about the internals of Selenium WebDriver.

This is the first in a series of technical posts by me about the internals of Selenium WebDriver. If you’re not interested in technical nitty-gritty, then feel free to step away now.

Still here? Excellent.

Let’s take a step back to just before the Selenium and WebDriver projects merged. There were, very obviously, two separate codebases. Looking closer and with a slightly different perspective, there were more than this. We used the test suites for webdriver to define the behaviour for multiple, largely independent, driver codebases. The IE driver was written in C, the HtmlUnit driver in Java and the Firefox driver is largely Javascript, and so on.

This means that there was a lot of “congruent code”: code that performed the same function but was implemented in a different way. The natural result of this was there was the possibility for behaviour to diverge between drivers. Worse, it meant that when a bug was found, we had to check it in every browser, and it wasn’t certain that an individual could actually fix the code. After all, not everyone is comfortable writing in all the languages we use on the project, or is au fait with all the technologies. For an Open Source project like Selenium, this is a major problem: we rely on a relatively small core of key developers backed up with a far larger team of individuals submitting small changes and fixes. Anything that makes it harder for us to function effectively as a development community is a Bad Thing.

So, we wanted a way off the island; a mechanism that would make it easy to share code between the various drivers and selenium core, that allowed us to fix a bug in one place only and have that fix ripple out to every driver that made use of this mechanism. More importantly, it had to be easy to use, and for someone not familiar with a raft of languages and technologies to quickly get started with.

What would this mechanism look like? Well, there’s a few things that feed into this, but the most important one, was that a majority of the code we’d think of merging was querying the state of the browser (“find an element”, “get the value of this attribute”) and, as Jason Huggins would point out to me at the drop of a hat, the natural language for querying the state of a browser is Javascript. One of the nice things with Javascript is that it’s possible to get a nice, fast development cycle going in it. Just modify a test, save and then hit “refresh” in the browser. That’s kind of attractive. Better still, there are a lot of developers familiar with Javascript.

So, we decided to use Javascript.

Because this shared code was to be composed of the smallest useful fragments of functionality required for browser automation we decided to refer to them as “Browser Automation Atoms”, or “atoms” for short. Rather than write them from scratch, the easiest thing to do was to extract them from the existing code — this is stuff that’s been battle-tested, so we know it’s robust.

There was one very obvious fly in the ointment: not every driver is written in Javascript. Although we have a mechanism available in every browser for executing JS, it’s wildly inefficient to dump an enormous lump of code on to the JS engine of the browser whenever you want to query the DOM. After all, most of the code would not be needed, and not all JS engines have been created equal. Some are blazingly fast. Others, not so much.

It would also be nice to break the code up into manageably-sized modules, rather than being in a single, monolithic file, which implies some clever “module loading” capability. Except this code isn’t always going to be executing inside an environment where writing “script” tags to load additional scripts is possible. You can’t do that in the guts of a firefox extension, though you can load files other ways. However we tie modules together will need to cope with that.

Ah! These opposing requirements: small modules containing the functions we want to use, no extraneous code, and for everything to be in a single file in order to minimize the pain of loading additional modules. That doesn’t sound like a very compatible list. How we resolved those differences is the topic of my next post….

Selenium at Agile 2010

The Selenium project does not have an ‘official’ presence here at Agile as it is seen as a ‘test after’ tool rather than ‘test first’…

The Selenium project does not have an ‘official’ presence here at Agile as it is seen as a ‘test after’ tool rather than ‘test first’ — even though it provides the magic of the ‘test first’ frameworks… But there is a small, unofficial contingent of recognizable faces around that can help people out and some sessions on it.

Sessions
Why your selenium tests are so dang brittle, and what to do about it – Wednesday, August 11 – 3:30 – 5:00

If you are writing automated through-the-GUI tests for a web application, you are in danger of creating tests that are more expensive to maintain than they are worth. With well-factored Selenium RC tests running in Junit or TestNG, you can keep your abstraction layers or “Lingos” — small bounded bits of slang for discrete parts of the object model — separate, thereby reducing the maintenance costs of your tests, and improving your sanity. Prerequisites include experience with Java or C#, and ideally some *basic* OOD familiarity (inheritance, composition, encapsulation, polymorphism).

Selenium Open Jam – Tuesday, August 10 – 11 – 12

Bring your questions or problems or complaints. We’ll try to ease / solve them.

People

  • Dawn Cannan – author of Confessions of a Passionate Tester and maintainer of the .NET version of Selenesse which is a bridge between Selenium and Fitnesse.
  • Adam Goucher (me) – maintainer of Selenium IDE and Selenium focused consultant
  • Jason Huggins – creator of Selenium and co-founder of Sauce Labs (Selenium in the cloud)
  • Patrick Wilson-Welsh – Agile coach and Selenium power user

If you are not succeeding with Selenium, come track down one of us. We might redirect you somewhere else, but eventually we’ll get you sorted out.

Selenium 2.0 backend for running IDE test suite via the Se2 Firefox

The GSoC 2010, it’s a great adventure. I’m Raynatou, I come from Burkina and do my internship at SERLI.

The GSoC 2010, it’s a great adventure.

I’m Raynatou, I come from Burkina and do my internship at SERLI. Like all interns in this company the topic of my internship focuses on advanced topics like the integration of WebDriver as backend for Selenium IDE. Selenium IDE is currently built upon Selenium Core for interacting with web pages. Selenium Core has several major limitations, including the inability to fire native events. To avoid these limitations and produce more robust tests, I am investigating Selenium IDE to using WebDriver in place of Selenium Core.

I’m mentored by Eric Allen from SauceLabs, my lead mentor, and by Jérémy Hérault from SERLI, his second but not least ;).

Eric has already done most of this integration earlier this year. The goal of his work is mostly to show what’s possible with Selenium IDE and the Selenium 2.0 Firefox driver. It is based on an asynchronous communication between the Firefox WebDriver extension and Selenium IDE, Se-IDE waiting for that WebDriver says to him that the current command has been passed with success (or not) to call the next command of the current test case (use of callback function). The goal of my mission is to finalize this integration. However, Eric being a crazy man, and he has done it quickly and together we though to another way to do this merge.

Our new thinking is based on a synchronous communication between both of them. To do it, I get the FirefoxDriver instance and play with it like a normal object, by calling its methods. But the behaviour of FirefoxDriver isn’t as simple as I was thinking. JavaScript being a powerfull language (yes, it can make you shiver), I’ve had just to replace some objects (like Response object) and to use a Proxy (and a bit of IoC-like code) to simplify my life and the code to do. You can see my work on GitHub and follow it.

Currently, I think that more than 95% of the Selenium API commands are usable with WebDriver as backend in Selenium IDE. The process was basically to go through the seleniumemulation package and port all of the Java classes into JavaScript methods on the WebDriver class.

Now, I’m working on Unit tests to cover any of the 2.0 work I’ve done. I managed to get all of the Selenium Core tests to run through IDE. I’ve some refactorings to do to optimize the code and add more comments for a bigger comprehension of my work. I have almost finished.

I hope you enjoy what I’m doing and we hope (me and my mentors) that this work can be included in the wave of Selenium 2.

A Smattering of Selenium #22

Happy Simcoe Day. Only a handful of links this week to mention.

Happy Simcoe Day. Only a handful of links this week to mention.

How to use Selenium 2 with Maven

There are several ways to use Selenium 2!

There are several ways to use Selenium 2:

  1. If you don’t have Selenium 1.x legacy code, you might want to directly use on of the new WebDriver implemenations like ChromeDriver, HtmlUnitDriver, FirefoxDriver, or InternetExplorerDriver which provide a nice, small and easy to learn API.
  2. If you have Selenium 1.x legacy code, you can still use the well known DefaultSelenium class or the new WebDriverBackedSelenium, which extends DefaultSelenium but uses one of the WebDriver implementations internally.

Whichever option you prefer, if you have want to use Maven, all you need to do is add the following dependency to your pom.xml:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium</artifactId>
    <version>2.0a5</version>
</dependency>

If you know, that you will only use a certain WebDriver implementation, e.g. the FirefoxDriver, you don’t need to depend on the selenium artifact (which has dependencies to all WebDriver implementations as well as the support classes). Instead you can add the dependency to just the artifact you need, e.g.

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>2.0a5</version>
</dependency>

When using a WebDriver implementation, there is no need to start a Selenium server – the browser will be directly started and remote controlled.

But if you are using DefaultSelenium (or the RemoteWebDriver implementation), you still need to start a Selenium server.

The best way is to download the standalone Selenium server jar and just use it.

Furthermore you can also embed the Selenium server into your own project, if you add the following dependency to your pom.xml:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.0a5</version>
</dependency>

Now you can create a SeleniumServer instance yourself and start it.

Be aware, that the selenium-server artifact has a dependency to the servlet-api-2.5 artifact, which you need to exclude, if your project will be run in a web application container.

Well, I hope that covers everything you need to know on how to use Selenium 2 with Maven.

Michael

A Smattering of Selenium #21

I thought it had been a slow week — until I looked at how many browser windows I had open.

I thought it had been a slow week — until I looked at how many browser windows I had open. I wonder if that was why things were feeling a bit sluggish…

The Current Status of Selenium 1 and Selenium 2

In the beginning there was Se1, and it was good. But it could have been better — in ways that WebDriver was starting to be good at.

In the beginning there was Se1, and it was good. But it could have been better — in ways that WebDriver was starting to be good at. Thus the brilliant idea was hatched to merge the two projects.

And then the confusion began. Let’s see if I can start to address some of it via a ficticious conversation that consolidates the Se-user list and #selenium irc channel.

There are a couple annoying bugs in Se-RC 1.03; when is the 1.0.4 release?

Se-RC 1.0.4 is planned for sometime towards the end of July 2010

I’ve heard rumours that 1.0.4 the to be the final release?

Yes. 1.0.4 is planned on being the final 1.x release

That’s crazy talk! I can’t use a .0 or ‘alpha’ release for my mission critical application

Actually, its not all that crazy — and needs a bit more explanation. Se2 is truly a merger of the two projects, in fact 2.0a1 was literally the Se code from the OpenQA repository and the WebDriver code its Google Code repository merged into a new one. This meant that from the first release of the 2.x series, it has contained 100% of the 1.x code which means 100% backwards compatibility. Later releases in the 2.x series have been driven primarily by evolutions of the code that came from WebDriver, not from Se 1.x.

OK, so 100% of Se 1.x is in 2.x; I get that. But how are you making sure that fixes to one get into the other?

Here is another ‘secret’ — don’t tell anyone, but there hasn’t been any pure 1.x development since the merging of the codebases. Every 1.x release since the merger has really been a 2.x release — but all packaged up to make it look like a 1.x release. This is why observant people have noticed a log message that looks something like 11:09:37.507 INFO – v2.0 [a4], with Core v2.0 [a4] when they start up their 1.x server.

So you’ve been releasing alpha code disguised as a stable release? Jerks!

Woah! Relax! Recall what I said above about it being backwards compatible by default. The ‘alpha’ tag is there because the API for the new code is still being developed and features flushed out. The 1.x code is however, still stable and still production quality.

Alright, I take back calling you folks jerks, but I really don’t like the alpha tag. When will it be out of ‘alpha’?

There is only one or two more features to implement (like handling alerts) in the WebDriver code and some cleanup before the betas start. But hope for a 2.0.0 final by the end of the year. And while we’re on the topic of ‘alpha’ vs. ‘beta’, this the team’s working definitions of each.

  • Alpha – APIs can, and likely will change. Possibly in dramatic ways.
  • Beta – With the APIs set, make sure they work with the major browsers

‘Major Browsers’ eh, what exactly does that mean?

Right now it means Firefox, Internet Explorer and at least one WebKit based one (Safari or Chrome)

In short… it is a requirement of Se2 that the server be backwards compatible with Se-RC 1.x and that has already been accomplished by building the code from a common source repository. This means that if you are using Se-RC, you can switch out the server for a 2.x one and have no impact on the execution of the scripts. Plus you can start to experiment with the new stuff that came over from WebDriver.

A Smattering of Selenium #20

12 hours late, but I was driving draft horses all day so that’s my excuse and I’m sticking with it.

12 hours late, but I was driving draft horses all day so that’s my excuse and I’m sticking with it. Enjoy. I’m going for a nap.

GSoC 2010 – Remote Storage

What’s new for Selenium this summer ? The GSoC of course !!!!

What’s new for Selenium this summer ? The GSoC of course !!!!

I’m Jérémy, a french engineer and I work at SERLI, a services company based in France.
I’m working on Selenium since a year and this summer I’m mentoring Aleksejs for the GSoC 2010. I’m helped by David Burns when I’m on vacation or offline. His experience is really useful to me, and David is involved on student supervising regularly.

Aleksejs comes from Latvia in Europe (yes I know you know but perhaps Geography wasn’t your favorite subject at school ;)). His work was initiated by Patrick and myself. We thought to a remote system that allows Selenium users to save and get remote test cases, directly with Selenium, without any other installations like SVN.

What’s better than record a test case with Selenium IDE and save it on your remote storage? what’s better than share your test cases with colleagues without any other installations, just by using Selenium IDE or a Selenium Remote Storage client?

For myself I don’t know what’s better 🙂

Aleksejs has already coded the server side of the remote storage mechanism with all the necessary unit tests. He has also created a web interface to use it directly through the browser. With his work, you can put, get and delete a test case, and you can also browse the directory where test cases are stored. His work has been done in Java, and he used JSON, for data representation for the communication protocol. This system is really simply to use, based on REST technology, you only have to call URLs with the good parameters.

The next step of his work is to create a Se-IDE plugin based on the API done by Adam (thanks to him). This part has to be done in less than a month and I think it’s a hard task, but it’s so cool to write your own plugin. In this case, Aleksejs will use JavaScript, AJAX and XUL technologies. It’s really good to learn a lot of technologies for its own culture, it’s so trainer.

I hope you’re enthousiastic to get this new feature, but wait until October, when the work will be finalized 🙂

Enjoy guys, Aleksejs, David and I are ready to discuss on it if you have any questions. And good luck with the end of this adventure Aleksejs.

Selenium 2.0a5 Released

I’m pleased to announce the release of Selenium 2.0a5, available for immediate download.

I’m pleased to announce the release of Selenium 2.0a5, available for immediate download. This release brings a host of changes under the hood, and represents the efforts of many contributors. Highlights include:

  • New interfaces for dealing with HTML 5 elements.
  • An API for “implicit waits“: quietly waiting until an element is present before continuing with a test. You can use them like this: driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS)
  • A revamped Firefox driver.
  • More shared code between Selenium and WebDriver.
  • You can now pass firefox profiles to the remote webdriver (this includes extensions and proxy settings!)
  • Improved .Net bindings: lots of updates to help bring them more in-line with the Java equivalents.

Waiting in the wings for release soon is an AndroidDriver, which opens up the world of testing webapps on Android devices through the Selenium WebDriver API.

If you’re a pythonista or rubyist, you’ve not been left out of this bonaza of new hotness. There have been regular updates for these languages, which can be installed via “easy_install -U selenium” or “gem install selenium-webdriver” depending on your language of choice.

Hopefully the next alpha will be the last before we plunge bravely into the betas. Exciting times are ahead!

A Smattering of Selenium #19

I’ve got a full day of driving ahead of me to go to a client so this is the early-morning (for me) edition of the Smattering post.

I’ve got a full day of driving ahead of me to go to a client so this is the early-morning (for me) edition of the Smattering post. That of course means there will be an absolute link explosion in about 20 minutes.

And lastly, BrowserMob, which was started by Se Core member Patrick Lightbody announced that it has been acquired by Neustar Webmetrics. Congrats! Now stop drinking the champagne and get back to work! 🙂

Selenium IDE – Looking back and looking forward

Its been around six months and three releases since I took the reins of Selenium-IDE.

Its been around six months and three releases since I took the reins of Selenium-IDE. The fundamental change in that time has been the adoption of a plugin model like the fine folks over that Firebug. (We’re also self-hosting it which is big from a project internals perspective.)

Right now, you can add custom user-extensions and formatters, but in the very near future you will be able to add location strategies as well.

So what does the future look like for Se-IDE?

  • 1.0.8 – A whack of bug fixes, and maybe the location strategies via plugins
  • 1.0.9 – If location strategies doesn’t get into 1.0.8, it will be here. And likely bug fixes.
  • 1.0.10 – Remove UI-Element from Se-IDE and make it a plugin

There is also work on reworking the internals of Se-IDE from a synchronous model to an asynchronous through Google Summer of Code. If that is successful and we decide to use it, that will trigger a bump to 1.1.0.

Timelines you ask? Well, when I took over Se-IDE the plan was to do it monthly. That was either naive or overly optimistic so they are starting to stretch a bit. 1.0.8 is going to stretch it some more too. Look for a beta of 1.0.8 towards the end of the month with a final version by mid-August.

I know you are likely wondering what cool, superdidooper features will you be seeing in Se-IDE over the next while? Ummm, well, actually none. At least not from the core Se-IDE. There will be significant pushback on any new ‘feature’ or change that adds something to Se-IDE. If you cannot accomplish your goal through a plugin, then I would consider than an omission in terms of the API.

Thats where we are from the maintainer perspective, but end-users also have sway over this as well to some degree. We’re now using the Google Code Issue Tracker for managing the project. If you bug is not there, there is a significantly smaller chance of it being addressed. And if an issue has a number of stars on it, that is also an indicator we should be looking at it.

Now to hack on locators…

A Smattering of Selenium #18

Not too much this week with various holidays around the world, but still managed to dig some things up.

Not too much this week with various holidays around the world, but still managed to dig some things up.

And lastly, the Selenium Stack Exchange proposal has progressed to the next level which is getting people to commit to using it. The number of commits is a convoluted formula, but every one counts. If you think the Se-Users mailing list is too crazy, this format might be better for you.

A Smattering of Selenium #17

Here are the posts dealing with Se, and/or automation in general that caught my eye and interest.

Here are the posts dealing with Se, and/or automation in general that caught my eye and interest.

  • Selenium Unit Test Reuse illustrates one way of iterating through environments and browsers in a script without using Se-Grid. I’ve done similar tricks to this to some success — the problem is usually reporting though, but you are all clever folks so I’m sure you could add it in.
  • Adding a custom header is sometimes required when writing a script, but its not really that documented so Kevin wrote How to Perform Basic Authentication in Selenium which combines how to do basic auth and header injection.
  • Not running your scripts inside CI yet? Shame on you! Hudson creator Kohsuke Kawaguchi gave a talk at Digg which they recorded. I haven’t watched it yet, but Se gets a mention according to the notes at the bottom.
  • Haven’t heard of the HAR (HTTP ARchive) format? Don’t worry, I hadn’t either until a bit of a discussion about the captureNetworkTraffic was had and its future in Se
  • The Faker/Sham combination is established in the Ruby (and Perl) world as the way to generate random data of a prescribed format. Anthony has release a similar module for Python with some pythonic twists called Picka (as in ‘Pick a card, any card’ erm, well, name or address actually)
  • Looking for an example of Page Objects in C#? I was last week and Dave convienently enough posted a page object pattern tutorial
  • Adieu to QTP. Now for a closer look at Selenium makes the list just because it uses ‘QTP’ and ‘Chinese bile farm’ in the same sentence.
  • Browsermob opensourced sep4j (which I think stands for ‘Se Parallel for Java’) which is a Collection of utilities for Java-based projects to enable Selenium test parallelization using Selenium Grid or Sauce
    Labs.
  • Richard presented at the LJC Unconference on ‘Agile Acceptance Testing with Cucumber, Cuke4Duke, Groovy & Selenium’ and has posted his slides
  • Speaking of acceptance tests, Gojko has a post on the Anatomy of a good acceptance test
  • Last thing on acceptance tests for this week is actually multiple things. Markus recently did a Weekend Testers event using RobotFramework and ParkCalc and has started a series of posts about it: Getting Started, ParkCalc automation – Refactoring a data-driven test and ParkCalc automation – Refactoring a keyword-driven test are the first three posts in it. Hopefully there will be more too.
  • And I’ll finish with one of my posts from this week which was on how to deal with pesky file downloads in Se. (hint: don’t use Se for downloading files)

A Smattering of Selenium #16

I’m going to start posting the Smattering posts here on the main Selenium blog, hopefully each Monday.

I’m going to start posting the Smattering posts here on the main Selenium blog, hopefully each Monday. For past ones see my personal blog’s archive

Selenium Grid 1.0.8 Released

We’re pleased to announce the release of Selenium Grid 1.0.8

We’re pleased to announce the release of Selenium Grid 1.0.8. This release fixes multithreaded issues with the Selenium Grid hub that appeared randomly under heavy load. If you’ve ever seen a log message about HttpClient being accessed by multiple threads, you definitely want to upgrade. Even if you haven’t, this release is highly recommended for all.

You can download it now or view the changelog. The list of changes is:

  • Multi-threaded issue with access to HttpClient has been resolved, fixing random crashes on a heavily loaded grids

Many thanks go out to Chris Gulley for identifying and fixing the problem. As always, patches and bug reports are appreciated:

I mentioned in the release notes for 1.0.7 that barring any major issues, 1.1 would be the next release. This fix was major enough to warrant an intermediate release. We are still planning to put out 1.1 as the next feature release.

If you have any questions about Selenium Grid, please use either the user or the developer list, as is most appropriate for the nature of your question. Ongoing discussion about grid development should take place on the developer list.

Selenium IDE 1.0.7 – Now with Drag-and-Drop!

So its a month later than planned, but Selenium IDE 1.0.7 is now available.

So its a month later than planned, but Selenium IDE 1.0.7 is now available. The delay was due to some internal build changes and not code, but one of the code changes that is there more than makes up for the delay.

That’s right, drag-and-drop has finally arrived to Se-IDE — though credit lies with Jérémy Hérault for implementing it.

Oh, and if you are Swedish, there is now a localization for you. Yes, a real one. Not just one that makes everything say Bork as was suggested to me. Although a Pirate locale might be arrr-some.

For those with version 1.0.5 or newer, the update will be pushed to you automatically over the next couple days. Those new to Selenium IDE or with 1.0.4 or older will want to install it now.

Other things of note around this release

Selenium Grid 1.0.7 Released

Following up on the Selenium Grid 1.0.6 release, we’re pleased to announce the release of Selenium Grid 1.0.7

Following up on the Selenium Grid 1.0.6 release, which was mostly a bug fix release, we’re pleased to announce the release of Selenium Grid 1.0.7. This is another bug fix release that focuses primarily on how Selenium Grid handles browser sessions.

You can download it now or view the changelog. The list of changes are:

  • Hub now instructs remote controls to shutdown a session if the hub is going to remove it due to being idle for too long
  • Added ability to specify timeout period when waiting for remote controls to become available. Now the client can timeout gracefully and decide what it would like to do next
  • Handle common case of session ID not being found, either because it timed out or was already closed; rather than raising a NullPointerException we now raise a NoSuchSessionException
  • Truncate long command response bodies to 128 characters
  • Retry remote control checks up to three times before deciding that a remote control is unreliable or unresponsive. This prevents aggressive unregistration of hosts that are busy or suffer from network issues

As always, patches and bug reports are appreciated:

Barring any critical issues, the next release of Selenium Grid will be 1.1 and will feature an enhanced Web view as well as a status API. After that, we will be moving from GitHub to Google Code to live alongside the other Selenium projects.

If you have any questions about Selenium Grid, please use either the user or the developer list, as is most appropriate for the nature of your question. Ongoing discussion about grid development should take place on the developer list.

The Future of Selenium Grid

As you likely know by now, after years of stewardship Philippe has stepped down as maintainer of Selenium Grid and has named me the new maintainer.

As you likely know by now, after years of stewardship Philippe has stepped down as maintainer of Selenium Grid and has named me the new maintainer. In this post, I hope to address the most immediate questions about what this means for the future of Selenium Grid.

Background

I realize many of you may not know who I am. I’ve been using Selenium in some capacity for close to five years now. I love working on open source software and do so primarily through my membership in the Apache Software Foundation and through my GitHub account. I hang out on the #selenium channel with the handle “nirvdrum” and have a personal page that includes some articles I’ve written and other things I’m involved with. Perhaps more importantly, I also rely on Selenium Grid for my latest start-up so I’m very keen on seeing the project mature and evolve.

Project Resources

The new canonical project repository on GitHub is the nirvdrum fork. However, within in the next month or so the project will be migrated from git and GitHub to subversion and the Selenium project on Google Code. As much as I personally prefer GitHub to Google Code, it makes the most sense from a community perspective for all Selenium projects to be hosted in the same location. The move will be made after Selenium Grid stabilizes a bit more. The 1.0.6 release was the first step in that process, but there may be one or two more minor patch releases. After the move, I’ll try to maintain a synchronized mirror of the code on GitHub so those that prefer to develop patches with git can continue to do so.

The canonical issue tracker is the Selenium issue tracker on Google Code. We will not be using either JIRA or GitHub Issues. I’ll try to migrate what I can over to the new tracker, but if I miss anything, please re-open the issue over there.

Project Evolution

Selenium Grid currently only works with Selenium 1.x, and consequently the 1.x compatibility interface in Selenium 2. There is currently no support for WebDriver. However, I fully intend to steer the product in that direction, while maintaining support for existing Selenium Grid installations (i.e., based on Selenium 1.x).

Since the project is moving to Google Code, all of the existing Selenium committers will have the ability to commit to the codebase. This should make the project’s evolution a much more collaborative effort. I’ll kickstart the process and likely lead the development effort, but the role of maintainer will be diminished (in a positive way) by allowing the entire core team equal access to the project.

Others are welcome to chime as well. Selenium Grid development discussion will be taking place on the Selenium developers list. Please continue to use the Selenium users list for usage and support inquiries.

Selenium 2.0a3 Released

Selenium 2.0a3 has been released. This is a major update to 2.0 and all users are encouraged to update.

Selenium 2.0a3 has been released and can be downloaded from the Selenium project site. This is a major update to 2.0 and all users are encouraged to update. The new features include:

  • An improved remote protocol.
  • Updating the version of HtmlUnit used to 2.7.
  • Improved support for simulating user interactions with the browser via native events on Linux.
  • Better support for Firefox 3.6.
  • Bug fixes

The .Net, Python and Ruby bindings will be updated soon, as will the maven artefacts.

The next release will be Selenium 2.0a4, and it is planned to include the following when it is released in late May:

  • Android support
  • A new API to support writing tests involving complex user interactions.
  • Far more integration of the underlying architecture.

Selenium Grid 1.0.6 Released

Following up on the Selenium Grid 1.0.5 release, we’re pleased to announce the release of Selenium Grid 1.0.6

Following up on the Selenium Grid 1.0.5 release, which added self-healing features to ease grid management, we’re pleased to announce the release of Selenium Grid 1.0.6. This is a bug fix release for 1.0.5 with some minor new additions.

You can download it now or view the changelog. The summary of changes are:

  • Fixed some concurrent modification issues that may have resulted in NullPointerExceptions
  • Fixed issue with shutting down workers with Rakefile
  • Added PID file support for hub and worker started via Rakefile, making it easier to use a process monitor such as monit

In case you missed the announcement, Philippe is no longer maintaining Selenium Grid. We thank him for his years of effort and helping the project get to where it is today. This is my first release as the new Selenium Grid maintainer. I will be getting out a new post shortly that lays out the future for the project [UPDATE: The promised post is live]. In the meanwhile, please note the new location of several key resources:

If you have any questions about Selenium Grid, please use either the user or the developer list, as is most appropriate for the nature of your question. Ongoing discussion about grid development should take place on the developer list. We look forward to hearing what you think about how we can improve the project.

Selenium 1.0.3 Released

Hot off the heals of 1.0.2, we’re releasing Selenium Remote Control 1.0.3!

Hot off the heals of 1.0.2, we’re releasing Selenium Remote Control 1.0.3. You can download it now.

There is no functional difference between this version and 1.0.2, other than it is packaged up a little nicer and we’ve clarified the relationship between selenium-server and the client drivers. That is: we are not releasing new client drivers with future 1.x releases. The reason is that we locked down the API in version 1.0.1 and so there is no need to push out the same code each time. As such, when you download 1.0.3, you’ll see all the client drivers are labeled version 1.0.1, which is expected.

This release also is zipped up in a way that is compatible with all operating systems. The 1.0.2 release had some reported issues on Windows that have been fixed.

Finally, we also had many requests from Maven users. While we no longer use Maven to build Selenium, we are including pom releases for both the standalone server (ie: selenium-server.jar) and the “coreless” server (ie: selenium-server-coreless.jar). We hope they will be in the central repository shortly.

Selenium 1.0.2 Released: Firefox 3.6 and Snow Leopard Support

Today we’re happy to announce that Selenium Remote Control 1.0.2 has been released!

Today we’re happy to announce that Selenium Remote Control 1.0.2 has been released. While most of our efforts are on Selenium 2.0, we understand that there are millions of Selenium users that still need the 1.x line supported. That’s why we’ve said from the start that our goal is make 2.x 100% backwards compatible with 1.x. And that’s why we’re releasing a new version of Selenium RC today.

Download it here.

In addition to many bug fixes, the biggest improvements in this version are support for both Firefox 3.6 and OS X Snow Leopard.

Welcome to the official Selenium blog!

Since we moved away from Clearspace for our forums, it’s time we also did the same for our blogging platform. We hope to be much better about posting news, tips, and tricks here going forward.

Since we moved away from Clearspace for our forums, it’s time we also did the same for our blogging platform. As such, the new location for the official Selenium blog will now be:

http://seleniumhq.wordpress.com

We hope to be much better about posting news, tips, and tricks here going forward.