Package org.jamesdbloom.acceptance

Source Code of org.jamesdbloom.acceptance.BasePage

package org.jamesdbloom.acceptance;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;

import java.io.UnsupportedEncodingException;

/**
* @author jamesdbloom
*/
public class BasePage {
    protected final Document html;

    public BasePage(String body) throws UnsupportedEncodingException {
        html = Jsoup.parse(body);
    }

    public String csrfValue() {
        Element csrfElement = html.select("#csrf").first();
        if (csrfElement != null) {
            return csrfElement.val();
        } else {
            return "";
        }
    }
}
TOP

Related Classes of org.jamesdbloom.acceptance.BasePage

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.