use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts in project htmlunit by HtmlUnit.
the class HtmlDateTimeInputTest method clearInput.
/**
* Verifies clear().
* @throws Exception if the test fails
*/
@Test
@Alerts("")
public void clearInput() throws Exception {
final String htmlContent = "<html>\n" + "<head></head>\n" + "<body>\n" + "<form id='form1'>\n" + " <input type='datetime' name='tester' id='tester' value='2018-06-12'>\n" + "</form>\n" + "</body></html>";
final WebDriver driver = loadPage2(htmlContent);
final WebElement element = driver.findElement(By.id("tester"));
element.clear();
assertEquals(getExpectedAlerts()[0], element.getAttribute("value"));
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts in project htmlunit by HtmlUnit.
the class HtmlDateTimeLocalInputTest method clearInput.
/**
* Verifies clear().
* @throws Exception if the test fails
*/
@Test
@Alerts("")
public void clearInput() throws Exception {
final String htmlContent = "<html>\n" + "<head></head>\n" + "<body>\n" + "<form id='form1'>\n" + " <input type='datetime-local' name='tester' id='tester' value='2018-06-12T19:30'>\n" + "</form>\n" + "</body></html>";
final WebDriver driver = loadPage2(htmlContent);
final WebElement element = driver.findElement(By.id("tester"));
element.clear();
assertEquals(getExpectedAlerts()[0], element.getAttribute("value"));
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts in project htmlunit by HtmlUnit.
the class HtmlDefinitionListTest method simpleScriptable.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts("[object HTMLDListElement]")
public void simpleScriptable() throws Exception {
final String html = "<html><head>\n" + "<script>\n" + LOG_TITLE_FUNCTION + " function test() {\n" + " log(document.getElementById('myId'));\n" + " }\n" + "</script>\n" + "</head><body onload='test()'>\n" + " <dl id='myId'>\n" + " <dt>Some Term</dt>\n" + " <dd>A description</dd>\n" + " </dl>\n" + "</body></html>";
final WebDriver driver = loadPageVerifyTitle2(html);
if (driver instanceof HtmlUnitDriver) {
final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
assertTrue(HtmlDefinitionList.class.isInstance(page.getHtmlElementById("myId")));
}
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts in project htmlunit by HtmlUnit.
the class HtmlDirectoryTest method simpleScriptable.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts("[object HTMLDirectoryElement]")
public void simpleScriptable() throws Exception {
final String html = "<html><head>\n" + "<script>\n" + LOG_TITLE_FUNCTION + " function test() {\n" + " log(document.getElementById('myId'));\n" + " }\n" + "</script>\n" + "</head><body onload='test()'>\n" + " <dir id='myId'>\n" + " <li>First Item</li>\n" + " <li>Secong Item</li>\n" + " </dir>\n" + "</body></html>";
final WebDriver driver = loadPageVerifyTitle2(html);
if (driver instanceof HtmlUnitDriver) {
final HtmlPage page = (HtmlPage) getWebWindowOf((HtmlUnitDriver) driver).getEnclosedPage();
assertTrue(HtmlDirectory.class.isInstance(page.getHtmlElementById("myId")));
}
}
use of com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts in project htmlunit by HtmlUnit.
the class HtmlScript2Test method simpleScriptable.
/**
* @throws Exception if the test fails
*/
@Test
@Alerts("[object HTMLScriptElement]")
public void simpleScriptable() throws Exception {
final String html = "<html><head>\n" + "<script>\n" + LOG_TITLE_FUNCTION + " function test() {\n" + " log(document.getElementById('myId'));\n" + " }\n" + "</script>\n" + "</head><body onload='test()'>\n" + " <script id='myId'></script>\n" + "</body></html>";
final WebDriver driver = loadPageVerifyTitle2(html);
assertEquals("script", driver.findElement(By.id("myId")).getTagName());
}
Aggregations