Changing a tests for javascript execution before a page is loaded. All drivers (except for HtmlUnit) allow to execute JS in this state. The spec allows it too.
@@ -461,11 +461,11 @@ public void testShouldBeAbleToExecuteScriptAndReturnElementsList() {
@NeedsFreshDriver
@NoDriverAfterTest
@Test
- @Ignore(value = ALL, reason = "Failure indicates hang condition, which would break the" +
- " test suite. Really needs a timeout set.")
- public void testShouldThrowExceptionIfExecutingOnNoPage() {
- Throwable t = catchThrowable(() -> executeScript("return 1;"));
- assertThat(t, instanceOf(WebDriverException.class));
+ @NotYetImplemented(value = HTMLUNIT,
+ reason = "HtmlUnit: can't execute JavaScript before a page is loaded")
+ public void testShouldBeAbleToExecuteScriptOnNoPage() {
+ String text = (String) executeScript("return 'test';");
+ assertEquals(text, "test");
}
@Test
