package pl.labno.bernard.htmlunified; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; import org.junit.Assert; import org.junit.Test; import java.io.IOException; public class SandboxTest { @Test public void test() throws IOException { final WebClient client = new WebClient(BrowserVersion.FIREFOX_3_6); client.setAjaxController(new NicelyResynchronizingAjaxController()); HtmlPage page = (HtmlPage) client.getPage("file:./target/test-classes/sandbox.html"); Assert.assertEquals("elementToHide", page.getElementById("elementToHide").asText()); page.getElementById("close").click(); Assert.assertEquals("", page.getElementById("elementToHide").asText()); } }