jolirium

Reusable Code for Selenium

License

License

GroupId

GroupId

com.jolira
ArtifactId

ArtifactId

jolirium
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

jolirium
Reusable Code for Selenium
Project URL

Project URL

http://code.google.com/p/jolira-tools/wiki/jolirium
Source Code Management

Source Code Management

http://github.com/jolira/jolirium

Download jolirium

How to add to project

<!-- https://jarcasting.com/artifacts/com.jolira/jolirium/ -->
<dependency>
    <groupId>com.jolira</groupId>
    <artifactId>jolirium</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.jolira/jolirium/
implementation 'com.jolira:jolirium:1.1.1'
// https://jarcasting.com/artifacts/com.jolira/jolirium/
implementation ("com.jolira:jolirium:1.1.1")
'com.jolira:jolirium:jar:1.1.1'
<dependency org="com.jolira" name="jolirium" rev="1.1.1">
  <artifact name="jolirium" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.jolira', module='jolirium', version='1.1.1')
)
libraryDependencies += "com.jolira" % "jolirium" % "1.1.1"
[com.jolira/jolirium "1.1.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.seleniumhq.selenium : selenium-api jar 2.22.0
org.seleniumhq.selenium : selenium-chrome-driver jar 2.22.0
org.seleniumhq.selenium : selenium-server jar 2.22.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.8.2

Project Modules

There are no modules declared in this project.

Jolirium

This is a small wrapper that manages Selenium instances and embedded servers. Multiple embedded servers are supported to be able to support scenarios that require such things (such as testing mobile applications).

Download

Binaries can be download from http://repo1.maven.org/maven2/com/jolira/jolirium/

Maven

Jolirium is available from the Central Maven Repository and all the mirrors using the following dependency:

<dependencies>
  <dependency>
    <groupId>com.jolira</groupId>
    <artifactId>jolirium</artifactId>
    <version>1.1.1</version>
  </dependency>
</dependencies>

Usage Example

Here is a handy utility class I often use. It reuses a JoliriumServer instance for all tests.

package com.jolira.test;
	private static JoliriumServer server = null;

	private static URL getBaseURL() {
		final String url = System.getenv("MY_BASE_URL");

		if (url == null) {
			throw new Error("Please define environment variable MY_BASE_URL");
		}

		try {
			return new URL(url);
		} catch (final MalformedURLException e) {
			throw new Error("TUX_BASE_URL is not valid", e);
		}
	}

	private static synchronized JoliriumServer getServer() {
		if (server != null) {
			return server;
		}

		final URL url = getBaseURL();

		return server = new JoliriumServer("*chrome", null, url);
	}

	public static Jolirium start() throws Exception {
		final JoliriumServer svr = getServer();

		return svr.getJolirium();
	}

Here is a real-life example with a test that uses Jolirium:

package com.jolira.test;

import static com.tmw.tuxrentalweb.test.JoliriumUtil.start;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.google.code.joliratools.jolirium.Jolirium;

public class MySpecialTest {
	private static Jolirium selenium;

	@BeforeClass
	public static void setUp() throws Exception {
		selenium = start();
	}

	@AfterClass
	public static void teardown() throws Exception {
		selenium.close();
	}

	@Test
	public void testUntitled() throws Exception {
		selenium.open("/home.do");
		selenium.click("link=Create an Account");
		selenium.waitForPageToLoad("30000");
		selenium.type("name=nameFirst", "Barry");
		selenium.type("name=nameLast", "Flue");
		selenium.type("id=emailID", "[email protected]");
		selenium.type("name=password", "badpassword1");
		selenium.select("id=eventType", "label=Special Event");
		selenium.select("name=eventMonth", "label=April");
		selenium.select("name=eventDay", "label=16");
		selenium.select("name=eventYear", "label=2014");
		selenium.type("name=phone", "000-000-0000");
		selenium.type("name=address1", "2380 Duckdale Rd");
		selenium.type("name=address2", "1099");
		selenium.type("name=city", "Houston");
		selenium.select("name=state", "label=Texas");
		selenium.type("name=zip", "77072");
		selenium.click("name=termsConditions");
		selenium.click("css=button.btn_account.create_account");
		selenium.waitForPageToLoad("30000");
		selenium.click("link=Your Dashboard");
		selenium.click("link=SIGN OUT");
		selenium.waitForPageToLoad("30000");
	}
}
com.jolira

Jolira

Versions

Version
1.1.1
1.0.2