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

export default class TypeAction extends TargetBasedAction {

    public text: string;

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

    public execOnTarget(page: puppeteer.Page, target: puppeteer.ElementHandle): Promise<any> {
        return target.type(this.text);
    }

}
