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

com.ui4j.sample.Sizzle Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.ui4j.sample;

import com.ui4j.api.browser.BrowserEngine;
import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;
import com.ui4j.api.browser.PageConfiguration;
import com.ui4j.api.browser.SelectorType;
import com.ui4j.api.dom.Document;
import com.ui4j.api.dom.Element;

public class Sizzle {

    public static void main(String[] args) {
    	BrowserEngine webkit = BrowserFactory.getWebKit();
    	PageConfiguration configuration = new PageConfiguration();
    	configuration.setSelectorEngine(SelectorType.SIZZLE);
    	Page page = webkit.navigate("http://sizzlejs.com", configuration);
    	Document document = page.getDocument();

    	Element element = document.query("h1:contains('Sizzle JavaScript Selector Library')");

    	System.out.println(element.getInnerHTML());

    	page.close();
    	webkit.shutdown();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy