changeset 91:ea44b6b5db42

JemmyFX: WebView wrap
author Oleg Barbashov <oleg.barbashov@oracle.com>
date Tue, 16 Oct 2012 21:11:26 +0400
parents ada1c4107f40
children d6cb0fee1422
files tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/WebViewApp.java tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/WebViewSample.java tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/button.html tools/Jemmy/JemmyFX/src/org/jemmy/fx/NodeWrapper.java tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebNodeParent.java tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebNodeWrap.java tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebViewWrap.java tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/WebViewApp.java tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/WebViewTest.java tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/button.html
diffstat 10 files changed, 631 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/WebViewApp.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ */
+
+package org.jemmy.samples.webview;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.VBox;
+import javafx.scene.web.WebView;
+import javafx.stage.Stage;
+
+public class WebViewApp extends Application {
+    static {
+        System.setProperty("http.proxyHost", "www-proxy.uk.oracle.com");
+        System.setProperty("http.proxyPort", "80");
+    }
+
+    WebView browser;
+    VBox pane;
+
+    public class MainScene extends Scene {
+        public MainScene() {
+            super(pane, 500, 500);
+
+            pane.setVgrow(browser, Priority.ALWAYS);
+            pane.getChildren().add(browser);
+        }
+    }
+
+    @Override
+    public void start(Stage stage) {
+        browser = new WebView();
+        browser.getEngine().load("file:///" + System.getProperty("user.dir") +  "\\samples\\org\\jemmy\\samples\\webview\\button.html");
+
+        pane = new VBox();
+        stage.setTitle(this.getClass().getSimpleName());
+        stage.setScene(new MainScene());
+        stage.show();
+    }
+
+    public static void main(String[] args) {
+        launch(WebViewApp.class, args);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/WebViewSample.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.jemmy.samples.webview;
+
+import javafx.scene.web.WebView;
+import org.jemmy.fx.SceneDock;
+import org.jemmy.fx.control.WebNodeDock;
+import org.jemmy.fx.control.WebViewDock;
+import org.jemmy.lookup.LookupCriteria;
+import org.jemmy.samples.SampleBase;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WebViewSample extends SampleBase {
+    static SceneDock scene;
+    
+    @BeforeClass
+    public static void launch() throws InterruptedException {
+        startApp(WebViewApp.class);
+        scene = new SceneDock();
+    }
+
+    @Before
+    public void reset() {
+    }
+
+
+    @Test
+    public void parent() {
+
+        // finding the WebView wrap
+        WebViewDock web_view = new WebViewDock(scene.asParent(), new LookupCriteria<WebView>() {
+            public boolean check(WebView cntrl) {
+                return true;
+            }
+        });
+
+        // WebViewWrap as parent for org.w3c.dom.Node
+        WebNodeDock body = new WebNodeDock(web_view.asWebViewParent(), new LookupCriteria<org.w3c.dom.Node>() {
+            public boolean check(org.w3c.dom.Node cntrl) {
+                // looking for HTML's body
+                if (cntrl.getNodeName().equals("BODY")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        // WebNodeWrap as parent for org.w3c.dom.Node
+        WebNodeDock button = new WebNodeDock(body.asWebViewParent(), new LookupCriteria<org.w3c.dom.Node>() {
+            public boolean check(org.w3c.dom.Node cntrl) {
+                // looking for button
+                if (cntrl.getNodeName().equals("BUTTON")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        button.wrap().mouse().click();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/samples/org/jemmy/samples/webview/button.html	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<button type="button">
+Hello world!!
+</button>
+
+</body>
+</html>
\ No newline at end of file
--- a/tools/Jemmy/JemmyFX/src/org/jemmy/fx/NodeWrapper.java	Sat Sep 29 08:11:25 2012 -0700
+++ b/tools/Jemmy/JemmyFX/src/org/jemmy/fx/NodeWrapper.java	Tue Oct 16 21:11:26 2012 +0400
@@ -71,6 +71,8 @@
         OPERATORS.add(SeparatorWrap.class);
         OPERATORS.add(TitledPaneWrap.class);
         OPERATORS.add(AccordionWrap.class);
+        OPERATORS.add(WebViewWrap.class);
+        OPERATORS.add(WebNodeWrap.class);
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebNodeParent.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.jemmy.fx.control;
+
+import java.util.ArrayList;
+import java.util.List;
+import javafx.concurrent.Worker;
+import javafx.scene.Scene;
+import javafx.scene.web.WebView;
+import org.jemmy.action.GetAction;
+import org.jemmy.control.Wrap;
+import org.jemmy.control.Wrapper;
+import org.jemmy.lookup.*;
+import org.jemmy.timing.State;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class WebNodeParent<ITEM extends org.w3c.dom.Node> extends AbstractParent<ITEM>
+        implements ControlList {
+
+    public static final String SELECTED_ITEM_PROP_NAME = "selectedItem";
+    protected Wrapper wrapper;
+    protected Class<ITEM> itemClass;
+    protected Scene scene;
+    WebViewWrap<? extends WebView> wrap;
+
+    public WebNodeParent(WebViewWrap<? extends WebView> webViewOp, Class<ITEM> itemClass) {
+        this.wrap = webViewOp;
+        this.wrapper = new ItemWrapper<ITEM>(webViewOp);
+        this.itemClass = itemClass;
+    }
+
+    public Wrapper getWrapper() {
+        return wrapper;
+    }
+
+    @Override
+    public <ST extends ITEM> Lookup<ST> lookup(Class<ST> controlClass, LookupCriteria<ST> criteria) {
+        return new PlainLookup<ST>(wrap.getEnvironment(),
+                this, wrapper, controlClass, criteria);
+    }
+
+    @Override
+    public Lookup<ITEM> lookup(LookupCriteria<ITEM> criteria) {
+        return this.lookup(itemClass, criteria);
+    }
+
+    @Override
+    public Class<ITEM> getType() {
+        return itemClass;
+    }
+
+    protected static class ItemWrapper<ITEM extends org.w3c.dom.Node> implements Wrapper {
+
+        WebViewWrap<? extends WebView> webViewOp;
+
+        public ItemWrapper(WebViewWrap<? extends WebView> webViewOp) {
+            this.webViewOp = webViewOp;
+        }
+
+        @Override
+        public <T> Wrap<? extends T> wrap(Class<T> controlClass, T control) {
+            if (controlClass.isAssignableFrom(org.w3c.dom.Node.class)) {
+                return (Wrap<? extends T>) new WebNodeWrap(webViewOp, (ITEM) control);
+            }
+            return null;
+        }
+
+    }
+
+    @Override
+    public List<ITEM> getControls() {
+        wrap.getEnvironment().getWaiter(WebViewWrap.PAGE_LOADING_TIMEOUT).ensureValue(Worker.State.SUCCEEDED, new State<Worker.State>() {
+            public Worker.State reached() {
+                return new GetAction<Worker.State>() {
+                    @Override
+                    public void run(Object... parameters) throws Exception {
+                        setResult(wrap.getControl().getEngine().getLoadWorker().getState());
+                    }
+                }.dispatch(wrap.getEnvironment());
+            }
+        });
+
+        return new GetAction<List<ITEM>>() {
+            protected void addChildren(List<ITEM> list, NodeList childNodes) {
+                for (int i = 0; i < childNodes.getLength(); i++) {
+                    final Node item = childNodes.item(i);
+                    list.add((ITEM) item);
+                    addChildren(list, item.getChildNodes());
+                }
+            }
+
+            @Override
+            public void run(Object... parameters) throws Exception {
+                List<ITEM> list = new ArrayList<ITEM>();
+                final NodeList childNodes = wrap.getControl().getEngine().getDocument().getChildNodes();
+                addChildren(list, childNodes);
+                setResult(list);
+            }
+        }.dispatch(wrap.getEnvironment());
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebNodeWrap.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.jemmy.fx.control;
+
+import com.sun.webpane.webkit.JSObject;
+import javafx.geometry.Orientation;
+import javafx.scene.Node;
+import javafx.scene.control.ScrollBar;
+import javafx.scene.web.WebView;
+import org.jemmy.JemmyException;
+import org.jemmy.Rectangle;
+import org.jemmy.action.GetAction;
+import org.jemmy.control.ControlInterfaces;
+import org.jemmy.control.ControlType;
+import org.jemmy.control.Wrap;
+import org.jemmy.dock.DockInfo;
+import org.jemmy.fx.Root;
+import org.jemmy.input.AbstractScroll;
+import org.jemmy.interfaces.*;
+import org.jemmy.lookup.Lookup;
+import org.jemmy.lookup.LookupCriteria;
+import org.w3c.dom.NodeList;
+
+@ControlType({org.w3c.dom.Node.class})
+@DockInfo(name = "org.jemmy.fx.control.WebNodeDock")
+@ControlInterfaces( value = {Parent.class, Showable.class},
+                    encapsulates = {org.w3c.dom.Node.class},
+                    name= {"asWebViewParent"})
+public class WebNodeWrap<CONTROL extends org.w3c.dom.Node> extends Wrap<CONTROL>
+                                                           implements Showable, Show {
+
+    private WebViewWrap<? extends WebView> view;
+    private String path = new String();
+    private JSObject bounds;
+
+    /**
+     *
+     * @param env
+     * @param scene
+     * @param nd
+     */
+    @SuppressWarnings("unchecked")
+    public WebNodeWrap(WebViewWrap<? extends WebView> pane, CONTROL node) {
+        super(pane.getEnvironment(), node);
+        this.view = pane;
+    }
+
+    public Class<WebView> getType() {
+        return WebView.class;
+    }
+
+    @Override
+    public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> boolean is(Class<INTERFACE> interfaceClass, Class<TYPE> type) {
+        if (Parent.class.equals(interfaceClass)
+                && org.w3c.dom.Node.class.isAssignableFrom(type)) {
+            return true;
+        }
+        if (Selectable.class.equals(interfaceClass)) {
+            return true;
+        }
+        return super.is(interfaceClass, type);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(Class<INTERFACE> interfaceClass, Class<TYPE> type) {
+        if (Parent.class.equals(interfaceClass)
+                && org.w3c.dom.Node.class.isAssignableFrom(type)) {
+            return (INTERFACE) new WebNodeParent(view, type);
+        }
+        return super.as(interfaceClass, type);
+    }
+
+    @Override
+    public Rectangle getScreenBounds() {
+        return new GetAction<Rectangle>() {
+            @Override
+            public void run(Object... parameters) throws Exception {
+                if (bounds == null) {
+                    if (path.isEmpty()) {
+                        getPath(getControl());
+                    }
+                    bounds = (JSObject)view.getControl().getEngine().executeScript("document" + path + ".getBoundingClientRect()");
+                }
+               
+                Integer right = (Integer)bounds.getMember("right");
+                Integer top = (Integer)bounds.getMember("top");
+                Integer bottom = (Integer)bounds.getMember("bottom");
+                Integer left = (Integer)bounds.getMember("left");
+
+                Rectangle rect = view.getScreenBounds();
+                setResult(new Rectangle(rect.x + left, rect.y + top, right - left, bottom - top));
+            }
+        }.dispatch(Root.ROOT.getEnvironment());
+    }
+
+    protected void getPath(org.w3c.dom.Node node) {
+        final org.w3c.dom.Node parentNode = node.getParentNode();
+        if (parentNode == null) {
+            return;
+        }
+        final NodeList childNodes = parentNode.getChildNodes();
+        for (int i = 0 ; i < childNodes.getLength(); i++) {
+            if (childNodes.item(i).equals(node)) {
+                path = ".childNodes[" + i + "]" + path;
+                getPath(parentNode);
+                break;
+            }
+        }
+    }
+
+    public Show shower() {
+        return this;
+    }
+
+    public void show() {
+        new GetAction() {
+            @Override
+            public void run(Object... parameters) throws Exception {
+                if (path.isEmpty()) {
+                    getPath(getControl());
+                }
+                String script = "document" + path + ".scrollIntoView(false)";
+                view.getControl().getEngine().executeScript(script);
+            }
+        }.dispatch(Root.ROOT.getEnvironment());
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/src/org/jemmy/fx/control/WebViewWrap.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.jemmy.fx.control;
+
+import javafx.scene.web.WebView;
+import org.jemmy.control.ControlInterfaces;
+import org.jemmy.control.ControlType;
+import org.jemmy.fx.NodeWrap;
+import org.jemmy.env.Environment;
+import org.jemmy.env.Timeout;
+import org.jemmy.interfaces.Parent;
+import org.jemmy.interfaces.TypeControlInterface;
+
+@ControlType({WebView.class})
+@ControlInterfaces( value = {Parent.class}, 
+                    encapsulates = {org.w3c.dom.Node.class},
+                    name= {"asWebViewParent"})
+public class WebViewWrap<CONTROL extends WebView> extends NodeWrap<CONTROL> {
+
+    public static final Timeout PAGE_LOADING_TIMEOUT = new Timeout("webview.page.loading.timeout", 5000);
+
+    static {
+        Environment.getEnvironment().initTimeout(PAGE_LOADING_TIMEOUT);
+    }
+
+    /**
+     *
+     * @param env
+     * @param scene
+     * @param nd
+     */
+    @SuppressWarnings("unchecked")
+    public WebViewWrap(Environment env, CONTROL nd) {
+        super(env, nd);
+    }
+
+    @Override
+    public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> boolean is(Class<INTERFACE> interfaceClass, Class<TYPE> type) {
+        if (Parent.class.equals(interfaceClass)
+                && org.w3c.dom.Node.class.isAssignableFrom(type)) {
+            return true;
+        }
+        return super.is(interfaceClass, type);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <TYPE, INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(Class<INTERFACE> interfaceClass, Class<TYPE> type) {
+        if (Parent.class.equals(interfaceClass)
+                && org.w3c.dom.Node.class.isAssignableFrom(type)) {
+            return (INTERFACE) new WebNodeParent(this, type);
+        }
+        return super.as(interfaceClass, type);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/WebViewApp.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ */
+
+package org.jemmy.fx.control;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.VBox;
+import javafx.scene.web.WebView;
+import javafx.stage.Stage;
+
+public class WebViewApp extends Application {
+    static {
+        System.setProperty("http.proxyHost", "www-proxy.uk.oracle.com");
+        System.setProperty("http.proxyPort", "80");
+    }
+
+    WebView browser;
+    VBox pane;
+
+    public class MainScene extends Scene {
+        public MainScene() {
+            super(pane, 500, 500);
+
+            pane.setVgrow(browser, Priority.ALWAYS);
+            pane.getChildren().add(browser);
+        }
+    }
+
+    @Override
+    public void start(Stage stage) {
+        browser = new WebView();
+        browser.getEngine().load("file:///" + System.getProperty("user.dir") +  "\\test\\org\\jemmy\\fx\\control\\button.html");
+
+        pane = new VBox();
+        stage.setTitle(this.getClass().getSimpleName());
+        stage.setScene(new MainScene());
+        stage.show();
+    }
+
+    public static void main(String[] args) {
+        launch(WebViewApp.class, args);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/WebViewTest.java	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.jemmy.fx.control;
+
+import javafx.scene.web.WebView;
+import org.jemmy.fx.SceneDock;
+import org.jemmy.lookup.LookupCriteria;
+import org.jemmy.samples.SampleBase;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WebViewTest extends SampleBase {
+    static SceneDock scene;
+    
+    @BeforeClass
+    public static void launch() throws InterruptedException {
+        startApp(WebViewApp.class);
+        scene = new SceneDock();
+    }
+
+    @Before
+    public void reset() {
+    }
+
+    @Test
+    public void test() {
+        WebViewDock web_view = new WebViewDock(scene.asParent(), new LookupCriteria<WebView>() {
+            public boolean check(WebView cntrl) {
+                return true;
+            }
+        });
+
+        WebNodeDock body = new WebNodeDock(web_view.asWebViewParent(), new LookupCriteria<org.w3c.dom.Node>() {
+            public boolean check(org.w3c.dom.Node cntrl) {
+                if (cntrl.getNodeName().equals("BODY")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        
+        WebNodeDock button = new WebNodeDock(body.asWebViewParent(), new LookupCriteria<org.w3c.dom.Node>() {
+            public boolean check(org.w3c.dom.Node cntrl) {
+                if (cntrl.getNodeName().equals("BUTTON")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+
+        button.wrap().mouse().click();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/Jemmy/JemmyFX/test/org/jemmy/fx/control/button.html	Tue Oct 16 21:11:26 2012 +0400
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<button type="button" style="position: absolute; top: 1000px; left: 1000px;">
+Hello world!!
+</button>
+
+</body>
+</html>
\ No newline at end of file