You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When screenshotParamsWhenToTakeAScreenshot=Always OR createAnimatedGif=true, the test fails when performing a click action on an element that disappears after the click(like after click we go to new page and clicked element isnt there). I beleive The failure occurs in performAction(ActionType action, By locator, Object data) method, specifically in this part if (screenshot[0] != null) { screenshot[0] = this.takeActionScreenshot((WebElement)((List)foundElements.get()).getFirst()); }
This results in a failure that prevents the test from continuing.
Link to SHAFT_Engine Console logs
Full console logs: Gist Link
Environment
SHAFT_Engine version that exhibits the issue (9.1.20250216 and before vesion):
Last SHAFT_Engine version that did not exhibit the issue (if applicable): not sure
Desktop OS: [ mac]
Desktop Browser (if applicable): [ chrome]
Desktop Browser Version (if applicable): latest
To Reproduce
Enable GIF creation OR Always take a screenshot in custom
properties File
Run a test case that clicks on an element that disappears immediately after the action.
The screenshot attempt fails, causing the test case to halt instead of proceeding.
test case example form the template project :
` @step("And I search for '{query}'.")
public Results searchForQuery(String query){
driver.element().type(searchBox, query)
.typeAppend(searchBox, String.valueOf(Keys.ENTER));
@Epic("SHAFT Web GUI Template") @Story("Google Basic Validations")@TmsLink("TC-002") @Description("Given I am on the Home page,\nWhen I search for a valid query,\nThen the result stats will show some data (will not be empty).") @Test(description = "Check that Result Stats is not empty after searching for a query.") public void checkResultStatsIsNotEmptyAfterSearchingForAQuery() { new Home(driver).searchForQuery(testData.getTestData("searchQuery")) .assertResultStatsIsNotEmpty(); }
Expected behavior
case run scussfully and gif created correctly ,without failling the test case.
Additional context
this issues some times on my frameWork raise other Exception but i think all are for the same resaon like this Root cause: "org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}" java.lang.RuntimeException: Root cause: "org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}" at com.shaft.gui.element.internal.Actions.report(Actions.java:501) at com.shaft.gui.element.internal.Actions.reportBroken(Actions.java:462) at com.shaft.gui.element.internal.Actions.performAction(Actions.java:246) at com.shaft.gui.element.internal.Actions.click(Actions.java:68) at focal.pages.login.Login.fillUsernameAndPasswordForAuditorRole(Login.java:79) at TestPackage.Screening.rs(IndividualBatchRecordsTests.java:174) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
The issue seems to originate from the performAction method when handling disappearing elements.
A potential fix might involve handling StaleElementReferenceException when taking screenshots.
The text was updated successfully, but these errors were encountered:
nouralaa96
changed the title
[Bug]: Test case Fails due to Click Action Fails When GIF or Screenshot Properties = Alaways Are Enabled
[Bug]: Test case Fails due to Click Action Fails When GIF or (Screenshot Properties = Alaways) Are Enabled
Feb 26, 2025
believe this issue was resolved with the latest release yesterday, although running with gif property for now take two much time like more than 30 sec for cases can be done in 3 sec. Apologies for creating . However, it would be a good practice to review older versions to understand why this happened, verify everything is working correctly, and ensure no further enhancements are needed.
Describe the bug
When screenshotParamsWhenToTakeAScreenshot=Always OR createAnimatedGif=true, the test fails when performing a click action on an element that disappears after the click(like after click we go to new page and clicked element isnt there). I beleive The failure occurs in performAction(ActionType action, By locator, Object data) method, specifically in this part
if (screenshot[0] != null) { screenshot[0] = this.takeActionScreenshot((WebElement)((List)foundElements.get()).getFirst()); }
This results in a failure that prevents the test from continuing.
Link to SHAFT_Engine Console logs
Full console logs: Gist Link
Environment
To Reproduce
Enable GIF creation OR Always take a screenshot in custom
properties File
Run a test case that clicks on an element that disappears immediately after the action.
The screenshot attempt fails, causing the test case to halt instead of proceeding.
test case example form the template project :
` @step("And I search for '{query}'.")
public Results searchForQuery(String query){
driver.element().type(searchBox, query)
.typeAppend(searchBox, String.valueOf(Keys.ENTER));
@Epic("SHAFT Web GUI Template") @Story("Google Basic Validations")@TmsLink("TC-002") @Description("Given I am on the Home page,\nWhen I search for a valid query,\nThen the result stats will show some data (will not be empty).") @Test(description = "Check that Result Stats is not empty after searching for a query.") public void checkResultStatsIsNotEmptyAfterSearchingForAQuery() { new Home(driver).searchForQuery(testData.getTestData("searchQuery")) .assertResultStatsIsNotEmpty(); }
Expected behavior
case run scussfully and gif created correctly ,without failling the test case.
like when this property is not
Screenshots
for failled while enable gif property
2025-02-26_11-15-50-353_AllureReport.html.zip
diable gif property works fine 👍
2025-02-26_11-12-59-017_AllureReport.html.zip
Additional context
this issues some times on my frameWork raise other Exception but i think all are for the same resaon like this
Root cause: "org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}" java.lang.RuntimeException: Root cause: "org.openqa.selenium.WebDriverException: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}" at com.shaft.gui.element.internal.Actions.report(Actions.java:501) at com.shaft.gui.element.internal.Actions.reportBroken(Actions.java:462) at com.shaft.gui.element.internal.Actions.performAction(Actions.java:246) at com.shaft.gui.element.internal.Actions.click(Actions.java:68) at focal.pages.login.Login.fillUsernameAndPasswordForAuditorRole(Login.java:79) at TestPackage.Screening.rs(IndividualBatchRecordsTests.java:174) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
The issue seems to originate from the performAction method when handling disappearing elements.
A potential fix might involve handling StaleElementReferenceException when taking screenshots.
The text was updated successfully, but these errors were encountered: