use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HtmlImage2Test method clickWithCoordinates.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts({ "58", "29", "58", "29" })
@NotYetImplemented
public void clickWithCoordinates() throws Exception {
try (InputStream is = getClass().getClassLoader().getResourceAsStream("testfiles/tiny-gif.img")) {
final byte[] directBytes = IOUtils.toByteArray(is);
final URL urlImage = new URL(URL_SECOND, "img.gif");
final List<NameValuePair> emptyList = Collections.emptyList();
getMockWebConnection().setResponse(urlImage, directBytes, 200, "ok", MimeType.IMAGE_GIF, emptyList);
}
final String html = "<html><head>\n" + "<script>\n" + LOG_TITLE_FUNCTION + " function clickImage(event) {\n" + " log(event.clientX);\n" + " log(event.clientY);\n" + " log(event.screenX);\n" + " log(event.screenY);\n" + " }\n" + "</script>\n" + "</head>\n" + "<body>\n" + " <img id='myImg' src='" + URL_SECOND + "img.gif' " + "width='100px' height='42px' onclick='clickImage(event)'>\n" + "</body>\n" + "</html>";
final WebDriver driver = loadPage2(html);
final Actions actions = new Actions(driver);
// this requires a webdriver change
actions.moveToElement(driver.findElement(By.id("myImg")), 0, 0).click().build().perform();
verifyTitle2(driver, getExpectedAlerts());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class MalformedHtmlTest method framesetInsideForm.
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts("frame loaded")
@NotYetImplemented
public void framesetInsideForm() throws Exception {
final String html = "<html>\n" + "<form id='tester'>\n" + " <frameset>\n" + " <frame name='main' src='" + URL_SECOND + "' />\n" + " </frameset>\n" + "</form>\n" + "</html>";
final String html2 = "<html><body>\n" + "<script>\n" + " alert('frame loaded');\n" + "</script>\n" + "</body></html>";
getMockWebConnection().setResponse(URL_SECOND, html2);
final WebDriver webDriver = loadPageWithAlerts2(html);
assertEquals(1, webDriver.findElements(By.name("main")).size());
assertEquals(0, webDriver.findElements(By.id("tester")).size());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class MalformedHtmlTest method framesetInsideTable.
/**
* @throws Exception if an error occurs
*/
@Test
@NotYetImplemented
public void framesetInsideTable() throws Exception {
final String html = "<html>\n" + "<table id='tester'>\n" + " <frameset>\n" + " <frame name='main' src='" + URL_SECOND + "' />\n" + " </frameset>\n" + "</table>\n" + "</html>";
final String html2 = "<html><body>\n" + "<script>\n" + " alert('frame loaded');\n" + "</script>\n" + "</body></html>";
getMockWebConnection().setResponse(URL_SECOND, html2);
final WebDriver webDriver = loadPageWithAlerts2(html);
assertEquals(0, webDriver.findElements(By.name("main")).size());
assertEquals(1, webDriver.findElements(By.id("tester")).size());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class MalformedHtmlTest method framesetInsideDiv.
/**
* @throws Exception if an error occurs
*/
@Test
@Alerts("frame loaded")
@NotYetImplemented
public void framesetInsideDiv() throws Exception {
final String html = "<html>\n" + "<div id='tester'>\n" + " <frameset>\n" + " <frame name='main' src='" + URL_SECOND + "' />\n" + " </frameset>\n" + "</div>\n" + "</html>";
final String html2 = "<html><body>\n" + "<script>\n" + " alert('frame loaded');\n" + "</script>\n" + "</body></html>";
getMockWebConnection().setResponse(URL_SECOND, html2);
final WebDriver webDriver = loadPageWithAlerts2(html);
assertEquals(1, webDriver.findElements(By.name("main")).size());
assertEquals(0, webDriver.findElements(By.id("tester")).size());
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented in project htmlunit by HtmlUnit.
the class HtmlTextArea2Test method getVisibleTextValueChangedFromJs.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts(DEFAULT = "Hello World", IE = "HtmlUnit")
@NotYetImplemented(IE)
public void getVisibleTextValueChangedFromJs() throws Exception {
final String html = "<html>" + "<head>\n" + "<script>\n" + " function test() {\n" + " document.getElementById('tester').value = 'HtmlUnit';\n" + " }\n" + "</script>\n" + "</head>\n" + "<body onload='test()'>\n" + "<form id='form1'>\n" + "<textarea id='tester'>Hello World</textarea>\n" + "</form>\n" + "</body></html>";
final WebDriver driver = loadPage2(html);
final String text = driver.findElement(By.id("tester")).getText();
assertEquals(getExpectedAlerts()[0], text);
if (driver instanceof HtmlUnitDriver) {
final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
assertEquals(getExpectedAlerts()[0], page.getElementById("tester").getVisibleText());
}
}
Aggregations