orbita
v5.4.0
Published
Framework for automated web surfing with Electron for testing or crawling websites. Works as node-process.
Downloads
43
Readme
orbita
Framework for automated web surfing with Electron for testing or crawling websites. Works as node-process.
Install
npm install orbita --save
or
yarn add orbita
Usage
import { sel, Window } from "orbita";
const window = new Window();
async function start() {
await window.open("http://www.google.com");
await window.input('input[name="q"]', "github");
await window.click("[name=btnK]");
await window.waitForNextPage();
const links = await window.grab(sel("div.g", [])); // grab with page-grabber module
console.log("Number of links: " + links.length);
await window.close();
}
start();
API
Window
interface IWindowConfig {
userDataDir?: string;
proxy?: string;
userAgent?: string;
}
constructor(config?: IWindowConfig);
click(selector: string): Promise<void>;
isVisible(selector: string): Promise<boolean>;
waitForNextPage(): Promise<string>;
url(): Promise<string>;
open(url: string): Promise<string>;
input(selector: string, text: string): Promise<void>;
grab<T>(conf: T, context?: string): Promise<T>;
close();
Test
npm install
npm test