This package has been deprecated

Author message:

This package is replaced by rallf-js-sdk

rallf-sdk

0.2.0 • Public • Published

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>

Readme

Keywords

none

Package Sidebar

Install

npm i rallf-sdk

Weekly Downloads

2

Version

0.2.0

License

ISC

Unpacked Size

33.8 kB

Total Files

17

Last publish

Collaborators

  • logginjs