Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.
/ headless-cr24 Public archive

Automatically download required webdriver/browser for headless testing with Chrome/Chromium

License

Notifications You must be signed in to change notification settings

FibreFoX/headless-cr24

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Headless-Cr24

Headless testing sometimes can be very frustrating, because you need to download some special native binary for the webdriver-communication, setting JVM-properties and having some browser installed and wired everything together.

To make your lives easier, this library was created, which downloads all required dependencies (native webdriver bridge and browser), sets the required JVM-properties and returns some ready-to-use WebDriver-instance.

Why that strange name?

Inside the periodic table of elements on position "24" there is "Chromium", the symbol is "Cr". I wanted to avoid putting "Chrome" or "Chromium" as being part of this library name, mostly to avoid possible legal consequences.

How to use?

Step 1: adding headless-cr24 as dependency

When using maven

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <!-- ... other stuff ... -->

    <dependencies>
        <!-- ... other dependencies ... -->
        <dependency>
            <groupId>de.dynamicfiles.projects.testing</groupId>
            <artifactId>headless-cr24</artifactId>
            <version>1.2.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

When using gradle

apply plugin: 'java'

// ... other stuff ...

dependencies {
    // ... other dependencies ...
    testCompile 'de.dynamicfiles.projects.testing:headless-cr24:1.2.0'
}

Step 2: create your WebDriver instance

import java.io.IOException;

import org.junit.Test;

import org.openqa.selenium.WebDriver;

import de.dynamicfiles.projects.testing.headless.cr24.Cr24DriverBuilder;
import de.dynamicfiles.projects.testing.headless.cr24.Cr24ConfigurationBuilderException;

public class YourWebbrowserTest {

    @Test
    public void getWebdriverWithDefaultConfiguration() throws IOException, Cr24ConfigurationBuilderException {
        WebDriver webDriver = Cr24DriverBuilder.getWebdriverWithDefaultConfiguration();

        webDriver.get("https://github.com/FibreFoX/headless-cr24");

        // ... your real testing stuff ...
    }
}

About

Automatically download required webdriver/browser for headless testing with Chrome/Chromium

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages