This issue has been created
There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-40b0cecf-a196-4005-832d-24eed150f071 XWIKI-25066 Open

LightboxIT fails intermittently with a StaleElementReferenceException when opening the lightbox from the image popover

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-4d1b7e9e-e044-4d47-a27a-f204e9d866df Vincent Massol created this issue on 01/Oct/26 09:54
 
Summary: LightboxIT fails intermittently with a StaleElementReferenceException when opening the lightbox from the image popover
Issue Type: cid:jira-generated-image-avatar-40b0cecf-a196-4005-832d-24eed150f071 Bug
Affects Versions: 18.4.6
Assignee: Unassigned
Components: Development Issues only
Created: 01/Oct/26 09:54
Labels: flickering
Priority: cid:jira-generated-image-static-major-e9a99fed-fd6e-454f-84ae-aab861791d7a Major
Reporter: Vincent Massol
Description:

Symptom

Several LightboxIT tests fail intermittently in LightboxPage#openLightboxAtImage: the image popover is displayed, but clicking its "open lightbox" button fails with:

org.openqa.selenium.StaleElementReferenceException: stale element reference: stale element not found in the current frame
	at org.xwiki.image.lightbox.test.po.ImagePopover.openLightbox(ImagePopover.java:62)
	at org.xwiki.image.lightbox.test.po.LightboxPage.openLightboxAtImage(LightboxPage.java:96)
	at org.xwiki.image.lightbox.test.ui.LightboxIT.openImageWithCaptionAndManuallyAddedId(LightboxIT.java:176)

Seen on Environment Tests, each time on Chrome 153 and each time failing 2 tests in the same run:

  • stable-18.8.x #19 (2026-09-30): openImageWithCaptionAndManuallyAddedId, openImageWithoutDescription
  • stable-18.4.x #137 (2026-09-27): openImageWithoutDescription, verifyDownload

This is a different failure from XWIKI-24532 (a timeout waiting for the popover to show up), which hasn't recurred. stable-18.4.x doesn't have the XWIKI-24532 change, so that change isn't the cause.

Cause

lightbox.js rebuilds the popover content from #imageToolbarTemplate each time the popover is shown (content is a function returning the template HTML). Any mousemove reaching the image after the popover became visible re-shows it 500ms later, which replaces the .openLightbox button the test has just located. One likely source is a mousemove that Chrome synthesizes after the popover insertion changes the layout under the still pointer. A popover hide (which detaches it) has the same effect.

Fix

ImagePopover#openLightbox() now catches StaleElementReferenceException/NoSuchElementException, waits for the popover to be displayed again and clicks the new button (up to 3 attempts).

 
 

3 updates

 
cid:jira-generated-image-avatar-4d1b7e9e-e044-4d47-a27a-f204e9d866df Changes by Vincent Massol on 01/Oct/26 09:54
 
Fix Version: 18.9.0-rc-1
Flickering Test: org.xwiki.image.lightbox.test.ui.AllIT$NestedLightboxIT#openImageWithCaptionAndManuallyAddedId
Assignee: Vincent Massol