selenide: Selenide creates a screenshot however does not report it in exception log
The Unit test generates the following trace:
Running org.integration.MyTest
10.21 21:01:40.267 ...
...
10.21 21:06:39.267 ...
test(org.integration.MyTest) Time elapsed: 48.189 sec <<< FAILURE!
com.codeborne.selenide.ex.ElementNotFound: Element not found {By.xpath: //table/tbody/tr/a='']}
Expected: not hidden
at sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:445)
at org.openqa.selenium.By$ByXPath.findElement(By.java:358)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:340)
at com.codeborne.selenide.impl.WebElementSelector.findElement(WebElementSelector.java:28)
at com.codeborne.selenide.impl.WaitingSelenideElement.getActualDelegate(WaitingSelenideElement.java:56)
at com.codeborne.selenide.impl.AbstractSelenideElement.checkCondition(AbstractSelenideElement.java:528)
at com.codeborne.selenide.impl.AbstractSelenideElement.should(AbstractSelenideElement.java:517)
at com.codeborne.selenide.impl.AbstractSelenideElement.invokeShould(AbstractSelenideElement.java:305)
at com.codeborne.selenide.impl.AbstractSelenideElement.dispatchSelenideMethod(AbstractSelenideElement.java:179)
at com.codeborne.selenide.impl.AbstractSelenideElement.dispatchAndRetry(AbstractSelenideElement.java:90)
at com.codeborne.selenide.impl.AbstractSelenideElement.invoke(AbstractSelenideElement.java:65)
at com.codeborne.selenide.impl.WaitingSelenideElement.invoke(WaitingSelenideElement.java:19)
at com.sun.proxy.$Proxy7.waitUntil(Unknown Source)
The test also generates two files:
$ ls -l
22072 Oct 21 21:03 1445454210701.0.html
97443 Oct 21 21:03 1445454210701.0.png
As stack trace is printed by JUnit after all tests are executed in one given test case (= class), I know only that test case was running between 21:01:40 and 21:06:39. File creation times fit that period, So given files should have been generated by this test case. However their names are not present in the stack trace.
Expected: If screenshot is taken, it’s name should appear in error dump. Otherwise screenshot should not be taken (it was created by mistake).
Note: Only one test (listed above) has failed in whole test suit. And there are only two given files generated for given date (21 Oct), so it couldn’t be that they belong to another test run.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 16 (11 by maintainers)
Commits related to this issue
- #234 remove usage of deprecated method in test — committed to selenide/selenide by asolntsev 5 years ago
- #234 add screenshot to error message in Maven too starting from some version, Maven uses `e.getClass()+e.getMessage()` instead of `e.toString()`. But Selenide added screenshot and timeout in `UIAsser... — committed to selenide/selenide by asolntsev 5 years ago
- #234 fix integration tests — committed to selenide/selenide by asolntsev 5 years ago
- #234 fix checkstyle issues — committed to selenide/selenide by asolntsev 5 years ago
- shorten the error message as it was before Selenide 5.3.1 instead of long message `com.codeborne.selenide.ex.ElementNotFound: Element not found {#customerDashboardButton}`, just use shorter message `... — committed to selenide/selenide by asolntsev 5 years ago
No, it looks like maven only ever uses the
.getMessage(), never the.toString().Not sure if anyone still watches this, and whether this was the case when this bug was reported, but I think the problem is that the screenshot information is only shown in
UIAssertionError.toString(), but not inUIAssertionError.getMessage(). And maven only shows the.getMessage()and (partial) stacktrace.