All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.webfolder.ui4j.sample.FormSubmit Maven / Gradle / Ivy

The newest version!
package io.webfolder.ui4j.sample;

import io.webfolder.ui4j.api.browser.BrowserEngine;
import io.webfolder.ui4j.api.browser.BrowserFactory;
import io.webfolder.ui4j.api.browser.Page;
import io.webfolder.ui4j.api.dom.Document;

public class FormSubmit {

	public static void main(String[] args) {
        String url = OpenHtmlFile.class.getResource("/FormSubmit.html").toExternalForm();
        BrowserEngine browser = BrowserFactory.getWebKit();
        Page page = browser.navigate(url);
        page.show();
        Document doc = page.getDocument();
        doc.query("input[type='text']").setValue("Foo");
        doc.query("form").getForm().submit();
        String response = doc.getBody().getText();
        System.out.println(response);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy