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

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

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

import java.util.List;

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;
import io.webfolder.ui4j.api.dom.Element;

public class FrameSample {

    public static void main(String[] args) {
        // Load sample file from classpath and get its URL location
        String url = FrameSample.class.getResource("/Frame.html").toExternalForm();

        // get the instance of WebKit browser
        BrowserEngine browser = BrowserFactory.getWebKit();

        // navigate to url & show the browser page
        Page page = browser.navigate(url);
        page.show();

        List frames = page.getDocument().queryAll("frame");

        Document documentFrame1 = frames.get(0).getContentDocument();
        Document documentFrame2 = frames.get(1).getContentDocument();

        System.out.println(documentFrame1.query("div"));
        System.out.println(documentFrame2.query("div"));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy