Skip to content

A browser automation library that uses SikuliX and doesn't grab your mouse

License

Notifications You must be signed in to change notification settings

waicool20/SKrypton

Repository files navigation

SKrypton Build Status Build status Download

A browser automation library that uses the SikuliX framework but doesn't grab the mouse.

This library uses QtWebEngine as its backbone for displaying webpages, therefore apart from SikuliX this project also has its own set of native components which need to be pre-installed. The library utilizes JNI to bridge between the native and JVM side.

The library works by providing its own sub-classes of Region, Match and Screen (Just prefixed with SKrypton) Each SKryptonScreen instance has its own virtual mouse, keyboard and clipboard. Therefore each can be controlled independently from each other and the desktop. To aid debugging, a virtual mouse indicator (Visibility can be toggled) has been added.

The name SKrypton comes from combining Script and Krypton, why Krypton? Because it's an element two Atomic Numbers away from Selenium another well-known browser automation tool named after an element. SKrypton can support control from Selenium if remote debug port is enabled.

Here's a small clip to see it in action

This is the file being showcased

Installation and Usage

I just want to run a SKrypton program!:

  • Requires Java JRE 8 installed
  • SKrypton Native components (Installable Jar under Downloads, just double click and follow instructions)

Developing with the API:

Official builds

SKrypton is available on the jcenter and maven central repository, replace VERSION with the version specified by the badge above or a version of your own choosing.

repositories {
    // For resolving SKrypton artifacts
    jcenter()       // or mavenCentral()
    // For resolving SikuliX artifacts
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
    compile group: 'com.waicool20.skrypton', name: 'skrypton-api', version: 'VERSION'
}

Snapshots

Snapshots for api jar are available here

To include the library API snapshot in your project you can add this snippet to your build.gradle file, replace VERSION with a specific snapshot (Take a look in the link above and get the latest one)

repositories {
    // For resolving SKrypton artifacts
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
    // For resolving SikuliX artifacts
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
    compile group: 'com.waicool20.skrypton', name: 'skrypton-api', version: 'VERSION'
}

Snapshots for the installers are also available in the group directory

Quick start (Kotlin API):

fun main(args: Array<String>) {
    /* Initialize the SKryptonApp instance with the args from the command line
       Since SKryptonApp is chromium based, we can enable DevTools on port 8888
       and access it through localhost:8888 */
    SKryptonApp.initialize(args, remoteDebugPort = 8888) {
        // Initialize a screen with the given URL
        screen("https://github.com/waicool20/SKrypton") {
            // Click coordinates X: 100 Y: 100
            // This is from the SikuliX API, refer to these docs for more info:
            // https://sikulix-2014.readthedocs.io/en/latest/region.html
            click(Location(100, 100))
        }
        // Initialize a screen with the given URL, width and height
        screen("https://github.com/waicool20/SKrypton", width = 800, height = 600) {
            // Type "Hello World!" into the screen.
            // This is from the SikuliX API, refer to these docs for more info:
            // https://sikulix-2014.readthedocs.io/en/latest/region.html        
            type("Hello World!") 
        }
        // Initialize a screen that doesn't show the virtual cursor
        screen("https://github.com/waicool20/SKrypton", showCursor = false) {
            // Move mouse to X: 100 Y: 100 but don't click
            // This is from the SikuliX API, refer to these docs for more info:
            // https://sikulix-2014.readthedocs.io/en/latest/region.html
            hover(Location(100, 100))
        }        
    }.exec(true) // Finally execute the SKryptonApp instance
}

Documentation

You are welcome to checkout the API documentation over here

Build instructions

Prerequisites:

Common:

  • Java JDK 8
  • CMake 3.9.x
  • Qt 5.9.1
    • QtWebEngine is a required component and must be installed
    • On Windows, MSVC version must be used (MinGW etc. versions are untested)

Linux:

  • GNU GCC7 (Available readily under this PPA ubuntu-toolchain-r-teston Ubuntu based distros)
  • GNU G++7 (Available readily under this PPA ubuntu-toolchain-r-teston Ubuntu based distros)
  • libGLESv2 (Typically incl. in libgles2-mesa package on Ubuntu based distros)
  • libEGL (Typically incl. in libegl1-mesa package on Ubuntu based distros)

Windows:


Actually building the project:

Linux:

# Build API Jar and native components release jar only
./gradlew build

# Build All Jars (incls. Test Jar and native components debug jar)
./gradlew buildAll

Windows:

# Build API Jar and native components release jar only
gradlew.bat build

# Build All Jars (incls. Test Jar and native components debug jar)
gradlew.bat buildAll

API Jar and Test Jar are generated under:

build/libs

Native component Jars are generated under:

native/build/libs

License

This project is licensed under the MIT license. See LICENSE.md for more details.

About

A browser automation library that uses SikuliX and doesn't grab your mouse

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published