Search in sources :

Example 6 with WebWindow

use of com.gargoylesoftware.htmlunit.WebWindow in project JSCover by tntim96.

the class HtmlUnitMergeTest method saveReportByJavaScript.

private void saveReportByJavaScript() throws IOException {
    WebClient webClient = new WebClient();
    HtmlPage page = webClient.getPage("http://localhost:9001/jscoverage.html");
    ((HtmlInput) page.getHtmlElementById("location")).setValueAttribute("http://localhost:9001/index.html");
    page.getHtmlElementById("openInWindowButton").click();
    webClient.waitForBackgroundJavaScript(100);
    // verifyTotal(webClient, page, 15);
    WebWindow webWindow = webClient.getWebWindowByName("jscoverage_window");
    ((HtmlPage) webWindow.getEnclosedPage()).executeJavaScript("jscoverage_report();");
    webClient.waitForBackgroundJavaScript(2000);
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) WebClient(com.gargoylesoftware.htmlunit.WebClient) HtmlInput(com.gargoylesoftware.htmlunit.html.HtmlInput) WebWindow(com.gargoylesoftware.htmlunit.WebWindow)

Example 7 with WebWindow

use of com.gargoylesoftware.htmlunit.WebWindow in project JSCover by tntim96.

the class HtmlUnitIsolateBrowserTest method shouldNotCombineCoverage.

@Test
public void shouldNotCombineCoverage() throws IOException, InterruptedException {
    HtmlPage page = webClient.getPage("http://localhost:9001/" + getTestUrl());
    page.getElementById("radio4").click();
    page.getHtmlElementById("launchDuplicate").click();
    webClient.waitForBackgroundJavaScript(100);
    WebWindow webWindow = webClient.getWebWindowByName("JSCoverInvertedModeDuplicateWindow");
    HtmlPage duplicatePage = (HtmlPage) webWindow.getEnclosedPage();
    duplicatePage.getElementById("radio1").click();
    duplicatePage.executeJavaScript("jscoverage_report();");
    webClient.waitForBackgroundJavaScript(2000);
    page = webClient.getPage("file:///" + new File(getReportDir() + "/jscoverage.html").getAbsolutePath());
    verifyTotal(page, 57, 12, 33);
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) File(java.io.File) WebWindow(com.gargoylesoftware.htmlunit.WebWindow) Test(org.junit.Test)

Aggregations

WebWindow (com.gargoylesoftware.htmlunit.WebWindow)7 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)6 HtmlInput (com.gargoylesoftware.htmlunit.html.HtmlInput)3 File (java.io.File)3 WebClient (com.gargoylesoftware.htmlunit.WebClient)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 HtmlElement (com.axway.ats.uiengine.elements.html.HtmlElement)1 ElementNotFoundException (com.axway.ats.uiengine.exceptions.ElementNotFoundException)1 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)1 NicelyResynchronizingAjaxController (com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController)1 Page (com.gargoylesoftware.htmlunit.Page)1 SilentCssErrorHandler (com.gargoylesoftware.htmlunit.SilentCssErrorHandler)1 WebRequest (com.gargoylesoftware.htmlunit.WebRequest)1 DomElement (com.gargoylesoftware.htmlunit.html.DomElement)1 DomNode (com.gargoylesoftware.htmlunit.html.DomNode)1 HtmlElement (com.gargoylesoftware.htmlunit.html.HtmlElement)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 Field (java.lang.reflect.Field)1