getting-started-with-selenium-framework

A quick and easy start-up browser automation framework using Selenium

License

License

GroupId

GroupId

io.ddavison
ArtifactId

ArtifactId

getting-started-with-selenium-framework
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

getting-started-with-selenium-framework
A quick and easy start-up browser automation framework using Selenium
Project URL

Project URL

http://github.com/ddavison/getting-started-with-selenium-framework
Source Code Management

Source Code Management

http://github.com/ddavison/getting-started-with-selenium-framework

Download getting-started-with-selenium-framework

How to add to project

<!-- https://jarcasting.com/artifacts/io.ddavison/getting-started-with-selenium-framework/ -->
<dependency>
    <groupId>io.ddavison</groupId>
    <artifactId>getting-started-with-selenium-framework</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/io.ddavison/getting-started-with-selenium-framework/
implementation 'io.ddavison:getting-started-with-selenium-framework:1.3'
// https://jarcasting.com/artifacts/io.ddavison/getting-started-with-selenium-framework/
implementation ("io.ddavison:getting-started-with-selenium-framework:1.3")
'io.ddavison:getting-started-with-selenium-framework:jar:1.3'
<dependency org="io.ddavison" name="getting-started-with-selenium-framework" rev="1.3">
  <artifact name="getting-started-with-selenium-framework" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.ddavison', module='getting-started-with-selenium-framework', version='1.3')
)
libraryDependencies += "io.ddavison" % "getting-started-with-selenium-framework" % "1.3"
[io.ddavison/getting-started-with-selenium-framework "1.3"]

Dependencies

compile (10)

Group / Artifact Type Version
junit : junit jar 4.10
org.seleniumhq.selenium : selenium-chrome-driver jar 2.43.1
org.seleniumhq.selenium : selenium-htmlunit-driver jar 2.43.1
org.seleniumhq.selenium : selenium-firefox-driver jar 2.43.1
org.seleniumhq.selenium : selenium-safari-driver jar 2.43.1
org.seleniumhq.selenium : selenium-ie-driver jar 2.43.1
org.seleniumhq.selenium : selenium-support jar 2.43.1
org.apache.commons : commons-lang3 jar 3.1
org.apache.logging.log4j : log4j-api jar 2.0.2
org.apache.logging.log4j : log4j-core jar 2.0.2

Project Modules

There are no modules declared in this project.

Conductor

See the site

star fork

Getting Started

Using maven, include it as a dependency:

<dependency>
  <groupId>io.ddavison</groupId>
  <artifactId>conductor</artifactId>
  <version>3.0.2</version>
</dependency>

Create a Java Class, and extend it from io.ddavison.conductor.Locomotive

Drivers

Drivers should be put in the resources folder of your project in a subdirectory called drivers, and be named like this:

Mac

chromedriver-mac-32bit

Windows

chromedriver-windows-32bit.exe

Linux

chromedriver-linux-32bit

So as an example, your project structure could be:

Project
| src
|   main
|     java
|       TestClass.java
|     resources
|       drivers
|         chromedriver-mac-32bit
|         chromedriver-windows-32bit.exe
|         chromedriver-linux-32bit
| pom.xml

Currently, six browsers are supported and they are Firefox, HTMLUnit, Chrome, Internet Explorer, Safari, and PhantomJS

Goals

The primary goals of this project are to...

  • Take advantage of method chaining, to create a fluent interface.
  • Abstract the programmer from bloated scripts resulting from using too many css selectors, and too much code.
  • Provide a quick and easy framework in Selenium 2 using Java, to get started writing scripts.
  • Provide a free to use framework for any starting enterprise, or individual programmer.
  • Utilize the power of CSS!

Actions

You can perform any action that you could possibly do, using the inline actions.

  • click(By)
  • setText(By, text)
  • getText(By)
  • hoverOver(By)
  • check(By)
  • uncheck(By)
  • navigateTo(url)
  • goBack()
  • isPresent(By)
  • getAttribute(By, attribute)
  • etc.

In-line validations

This is one of the most important features that I want to accentuate.

  • validateText
  • validateTextNot
  • validateChecked
  • validateUnchecked
  • validatePresent
  • validateNotPresent
  • validateTextPresent
  • validateTextNotPresent

All of these methods are able to be called in-line, and fluently without ever having to break your tests.

Switching Windows

Another nice feature that is offered, is the simplicity of window switching in Selenium.

  • switchToWindow(regex)
  • waitForWindow(regex)
  • closeWindow(regex)

All of these functions take a regular expression argument, and match either the url or title of the window that you want to interact with.

Switching Frames

  • switchToFrame(idOrName)
  • switchToDefaultContent()

Implicit Waiting

In addition to the Selenium 2 implicit waiting, the AutomationTest class extends on this concept by implenting a sort of waitFor functionality which ensures that an object appears before interacting with it. This rids of most ElementNotFound exceptions that Selenium will cough up.

See a working example of what a test script written using this framework might look like.

Pull requests

If you have an idea for the framework, fork it and submit a pull-request!

Versions

Version
1.3
1.2
1.1
1.0