![Gitter](https://badges.gitter.im/Join Chat.svg)
Minium is a framework, developed by Rui Figueira @ VILT, that combines jQuery and Selenium for browser testing and tasks automation. It also provides an interactive console that easily lets you execute Minium instructions, providing you immediate feedback.
In today's JavaScript development landscape, jQuery is the dominant auxiliar library. A major contributor for this state of affairs is JQuery's powerful element selector engine. Now ubiquous in use, it provides a quick and intelligible way to select precisely the elements we want. At the other end of the development spectrum, Selenium is currently the most popular automation framework due to its innovative WebDriver API. Minium combines Selenium's impressive automation capabilities with jQuery's selector engine to produce a simple way to create elaborate automation tasks in the complex web interfaces of today.
You may be thinking: big deal, there are several other tools for browser automation... That's true, but:
- can those tools access another window (for instance, popup windows) in a easy way? Minium can!
// will look to ALL opened windows to find a text field with label "Username", and fill it with a value
usernameFld = $(wd).window().find(":text").withLabel("Username");
- can those tools easily access iframes? Minium can!
// will look to ALL frames in the main page to find a text field with label "Username"
usernameFld = $(wd).frame().find(":text").withLabel("Username");
- can those tools select elements based on their relative position to other elements? Minium can!
- can those tools 'speak' and teach you how to use themselves? Minium can!
- can those tools write their own documentation? Minium can!
You can watch all available Minium videos at Youtube playlist.
The easiest way to try Minium is to use Minium App, which contains Minium Web Console (you can watch the video 'Minium shows its new Web Console' for a small introducion) and a bundled Jetty server. This way, you can instruct Minium to do almost anything in a browser with a few lines of Javascript.
Ensure that the following software is installed:
- Java JDK 1.7+ (required)
- Don't forget to set
JAVA_HOME
environment variable
- Don't forget to set
- Google Chrome (required)
To install and run Minium App, just follow these instructions:
- Download one of the following compressed files:
- Uncompress it in some folder (e.g.
c:\Tools\minium-app
) - By default, Selenium (and therefore Minium) can run Firefox out of the box. For other browsers, you will need specific drivers. Just download the ones you want to use (see links below) and place the corresponding executable files in
drivers
folder: - To launch Minium, just run one of the following executables:
minium-app.exe
(in windows)bin\minium-app.bat
(also in windows, but this way you can see the stdout)bin\minium-app
(linux or mac)
If Minium doesn't open a chrome app when you execute any of those scripts, probably you'll need to indicate where your chrome binary is in minium-prefs.json
(edit specify the full Chrome binary path in the chromeBin
property).
You're now able to create a web driver. Just go to Web Drivers
, pick your prefered browser and name it wd
. Then, just type the following code and run it by selecting it and pressing Ctrl+ENTER
:
get(wd, "http://www.google.com/ncr");
speak("Hello, I'm Minium, and I'm alive");
speak("Let me highlight google search box");
searchbox = $(wd, ":text").withName("q");
highlight(searchbox);
speak("Minium = Minion + Selenium. Let's find out what is a Minion.");
fill(searchbox, "minion");
sendKeys(searchbox, [ Keys.ENTER ]);
wikipediaResult = $(wd, "h3 a").withText("Minion - Wikipedia, the free encyclopedia");
click(wikipediaResult);
firstParagraph = $(wd, "#mw-content-text p").first();
highlight(firstParagraph);
speak("Wikipedia says: " + firstParagraph.text());
Or try this other script:
get(wd, "https://docs.google.com/spreadsheet/ccc?key=0Al0ulrJIDCUVdEhoSDlRbVZYWUt5ZVJCb1pVb0h1UFE");
var loading = $(wd, "#waffle-loading-screen").visible();
var sheetTabs = $(wd, ".docs-sheet-tab-name");
var numFrames = sheetTabs.size();
for (var time = 0; time < 4 * numFrames; time++) {
waitWhileNotEmpty(loading);
var sheetTab = sheetTabs.eq(time % numFrames);
click(sheetTab);
}
Building Minium is not complicated. Ensure that the following software is installed:
- Java JDK 1.6+ (required)
- Don't forget to set
JAVA_HOME
environment variable
- Don't forget to set
- Maven 3
Then, just clone Minium git repository and use Maven to build it:
git clone git://github.com/viltgroup/minium.git
cd minium
mvn install -DskipTests=true
Note: if you really want to run the tests, then make sure you have PhantomJS installed and available in the PATH
environment variable. Then just replace mvn install -DskipTests=true
by mvn install
.
You can then use the built Minium App found at minium-app/target/minium-app
.
A quick guide on how to use Minium in a Java project or using its Interactive console can be found here:
If you feel that's too simple, check this one:
You can also check the Minium API documentation. For a complete list of allowed methods, check the links below.
Minium is licensed under Apache 2.0.