Selenium is normally used for the automation of and end-to-end testing against a web application. But sometimes you may just want to automate some repetitive task that you do often to simply save yourself some time.

Or you can create an application that executes Selenium actions, but pauses after certain steps to allow you to visually inspect hard-to-automate, visually intensive activities. You can use Selenium for these types of tasks as well.

Reasons to create an automated test with manual steps

For example: I work for a large company, and we need to validate each tool that we use to tests our applications. In order to validate Selenium, we created a Java command line application that allows us to automate the verification process and manually visually inspect after action to verify that it actually worked.

To do this, we created a command line Java application that would launch a browser and enter text into a field then pause — which allowed us to verify that it performed the sendkey and entered the correct text. When a user hit the enter button, it would perform the next step then pause again, and so on.

Because of the type of validation we had to do, we needed an actual person, not a junit assertion, to verify that each step did, indeed, work.

I’m not sure how often you might actually need to use this technique, but if you use it only once it was worth the time it took to write this. To do this in Java, you can simply create a self-contained test and just pass someone the jar file.

Also – and this is one thing that has always annoyed me about QTP – a user cannot create a small, executable program that could run the test on another machine without having to have a full blown version of QTP on it.

With Selenium this isn’t a problem.

Let’s take a quick look at an example to show you what I mean.

Create an executable Selenium Java project

import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Assert;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.*;
WebDriver driver = new FirefoxDriver();
driver.get("https://testguild.com/HpSupport.html");
Assert.assertEquals("Joe's HP Support Matrix Tool for QTP, LoadRunner, "
 + "Service Test and Quality Center",driver.getTitle());
System.out.println("====Enter to continue====");
System.in.read();
WebElement tools = driver.findElement(By.id("tools"));
tools.sendKeys("QTP10");
WebElement version = driver.findElement(By.id("areas"));
version.sendKeys("BROWSERn");
System.out.println("====Verify Grid is correct after selecting Tool and Version====");
System.out.println("====Test Done====");


That’s it – nice and simple. Now let’s create an executable file for our test.


Run your jar Selenium file from the command line

> java –jar AllInOne.jar

Cool – right!?

If you really want to prove that this works, go ahead and copy the jar file on another computer that has Java installed and run it there.

It should behave the same way.

There are a bunch of things you could do with this – I’ll leave it up to you to think of some cool ways to use it.