import * as puppeteer from "puppeteer";
import { Rule } from "../rule";
import Word from "../word";
import Action from "./action";

export default class GoToAction extends Action {
    public url: string;

    constructor(word: Word, rule: Rule, url) {
        super(word, rule);
        this.url = url;
    }

    public exec(page: puppeteer.Page): Promise<any> {
        return page.goto(this.url, {waitUntil: "domcontentloaded", timeout: 0});
    }
}
