【问题标题】:UI4J - navigate show hide error bug ? Full sample code included.UI4J - 导航显示隐藏错误错误?包括完整的示例代码。
【发布时间】:2016-05-23 14:24:28
【问题描述】:

下面这个第二次导航失败,为什么?

UI4J 或我的代码/系统中是否存在错误?在 Ubuntu 15.10 上。使用 Java 8u40。

package mypackage.Web.tests.main;

import com.ui4j.api.browser.BrowserEngine;
import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;

public class UI4JNavigateShowHideErrorDemo {

    public static void main(String[] args) throws InterruptedException {
        BrowserEngine engine = BrowserFactory.getWebKit();

        navigateShowAndClose(engine);

        navigateShowAndClose(engine);

        System.out.println("Never reaches this stage because on the second navigate it gets stuck.");
    }

    public static void navigateShowAndClose(BrowserEngine engine) throws InterruptedException {
        System.out.println("Navigating");

        Page page = engine.navigate("http://www.google.com/");

        System.out.println("Showing");

        page.show();

        System.out.println("Sleeping");

        Thread.sleep(500);

        System.out.println("Closing");

        page.close();   // Same with page.hide()
    }       
}

【问题讨论】:

    标签: ui4j


    【解决方案1】:

    好的,所以在研究了这个之后,似乎需要调用:

    Platform.setImplicitExit(false);

    为了防止这个问题发生。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多