0.0.4 • Published 2 years ago

@mmologin/browser-action v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Instruction

I. Navigation Actions:

1. Activate Tab:

method: activateTab
params:
  + options: {
    index: number;
  }

2. Close Browser:

method: closeBrowser

3. Close Tab:

method: closeTab
params:
  + options: {
    index?: number;
    current: boolean;
  }

4. Go Back:

method: goBack
params:
  + options?: {
    timeout?: number;
    waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  }

5. Go Forward:

method: goForward
params:
  + options?: {
    timeout?: number;
    waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  }

6. New Tab:

method: newTab
params:
  + options?: {
    url?: string;
    timeout?: number;
    waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  }

7. Open Url:

method: openUrl
params:
  + options: {
    url: string
    timeout?: number;
    waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  }

8. Reload Tab:

method: reloadTab
params:
  + options: {
    index?: number;
    current: boolean;
    timeout?: number;
    waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
  }

II. Mouse Actions:

1. Click:

method: click
params:
  + options: {
    clickCount?: number
    delay?: number
    mouseButton?: 'left' | 'right'
    selectBy: {
      coordinates?: {
        x: number;
        y: number;
      };
      selector?: {
        type: 'xpath' | 'css' | 'text';
        value: string;
      }
    }
  }

2. Move Mouse:

method: moveMouse
params:
  + options: {
    coordinates: {
      x: number;
      y: number;
    }
  }

3. Scroll:

method: scroll
params:
  + options?: {
    timeoutSecs?: number;
    maxScrollHeight?: number;
    waitForSecs?: number;
    scrollDownAndUp?: boolean;
  }

III. Keyboard Actions:

1. Press Key:

method: pressKey
params:
  + options: {
    delay?: number;
    keys?: string[];
  }

2. Type Text:

method: typeText
params:
  + options: {
      selector: {
        type: 'xpath' | 'css' | 'text';
        value: string;
      };
      speed?: number;
      text: string;
      typeAsHuman?: boolean;
  }

IV. Data Actions:

1. Check Element Exists:

method: checkElementExists
params:
  + options: {
    selector: {
      type: 'xpath' | 'css' | 'text';
      value: string;
    };
    timeout?: number;
  }

2. Cookies:

method: cookies
params:
  + options: {
    type: 'import' | 'export' | 'clear';
    path?: string;
  }

3. Get Attribute:

method: getAttribute
params:
  + options: {
    attributeName: string;;
    selector: {
      type: 'xpath' | 'css' | 'text';
      value: string;
    };
    variable: string;
  }

4. Get Text:

method: getText
params:
  + options: {
    selector: {
      type: 'xpath' | 'css' | 'text';
      value: string;
    };
    variable: string;
  }

4. Get Url:

method: getUrl
params:
  + options: {
    variable: string;
  }

5. Save Asset:

method: saveAsset
params:
  + options: {
    fileName?: string
    outputDir: string
    saveAssetBy: {
      selector?: {
        type: 'xpath' | 'css' | 'text';
        value: string;
      }
      url?: string
    }
  }

6. Select Dropdown:

method: selectDropdown
params:
  + options: {
    selector: {
      type: 'xpath' | 'css' | 'text';
      value: string;
    };
    selectedValue: string;
  }

7. Set Variable:

method: setVariable
params:
  + options: {
    variable: string;
    operator: '=' | '+' | '-' | '*' | '/' | 'Concatenate';
    value: string;
  }

8. Upload File:

method: uploadFile
params:
  + options: {
    clickToUpload?: boolean;
    filePath: string;
    selector?: {
      type: 'xpath' | 'css' | 'text';
      value: string;
    };
  }

V. Other Actions:

1. Condition:

method: condition
params:
  + options: {
    leftOperand: string;
    operator: '<' | '>' | '=' | '!=' | '<=' | '>=';
    rightOperand: string;
  }

2. Emulate:

method: emulate
params:
  + options: {
    device: {
      userAgent: string;
      viewport: {
        width: number;
        height: number;
      };
    }
  }

3. Eval:

method: eval
params:
  + options: {
    script: string;
    variable: string;
  }

4. Loop:

method: loop
params:
  + options: {
    actions?: {
      type: string;
      options: any;
    }[]
    loopType: 'for' | 'while';

    // Use for loop type "For"
    forFromValue?: number | string;
    forToValue?: number | string;

    // Use for loop type "While"
    leftOperand?: string;
    operator?: '<' | '>' | '=' | '!=' | '<=' | '>=';
    rightOperand?: number | string;
  }

5. Screenshot:

method: screenshot
params:
  + options: {
    fileName: string;
    filePath: string;
  }

6. Sleep:

method: sleep
params:
  + options: {
    seconds: number;
    random?: {
      from: number;
      to: number;
    }
  }
0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago