0.2.0 • Published 7 years ago

rallf-sdk v0.2.0

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

RobotUnion Node.js SDK (experimental)

Toolset to create Robot Apps for RALLF based on selenium-webdriver

Index

First steps

Installation

  • Run npm install rallf-sdk --save to install the sdk

Create simple Robot Task

  • Create the Task manifest manifest.json within the config folder

    {
      "name": "robot-dev-example",
      "type": "web",
      "main": "src/main.js",
      "version_name": "1.0.0",
      "key": "access_key",
      "secret": "access_secret",
      "language": "nodejs|python",
      "capabilities": {
        "browserName": "firefox|chrome",
        "headless": false
      }
    }
    • The name of your task will be the one in manifest.json
    • You can get the access key and secret from RALLF Panel
    • main: should be the main file of the RobotApp src/main.js
  • Create a src folder within your app folder
  • Now create the main file for your app main.js inside src

  • RobotApp Example

    /*
      File: 'src/main.js'
    */
    const Task = require('../Execution/Task');
    
    class MyFirstTask extends Task {
      constructor() {
        super();
      }
    
      error(err) {
        this.logger.error('There has been an error ' + err);
        this.finish(1);
      }
    
      onFinish() {
        this.logger.debug("On finish");
      }
    
      onBeforeStart() {
        this.logger.debug("Before start");
      }
    
      run() {
        let device = this.device;
        let logger = this.logger;
        let robot = this.robot;
        let input = this.input;
    
        logger.debug("Task Asdfsd started with robot: " + robot.self.alias);
    
        // Must return a promise
        return device.get('https://github.com/')
          .then(_ => device.getTitle())
          .then(_ => logger.debug('title: ' + _));
      }
    }
    module.exports = MyFirstTask;
    • First you need to require Task from Execution/Task
    • Now create a class to extend Task from
    • Finally create a run function, this funtion is going to run when the Task is executed.
    • Check the docs here: selenium-webdriver

Run Locally

This will run the task as and log locally.

$ node ./node_modules/rallf-sdk/bin/rallf-js-runner.js .

Usage: rallf-js-runner.js <task_path> <json_robot> <json_input>

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago