0.2.0 • Published 6 years ago

rallf-sdk v0.2.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 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

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago