Click all a tags in ul li in html problem

I listed all li tags in page.
Then click withhin for loop each a tags in the following li.

List listMyTraining = WebUI.findWebElements(findTestObject(‘my_training_box’), 2)

for (def list : listMyTraining) {
list.findElement(By.tagName(‘a’)).click()

WebUI.delay(15)

}

After clcikin the first a tag it gives exception

Test Cases/WEB UI TESTS/SDB Course Play FAILED.
Reason:
org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: chrome=84.0.4147.89)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/stale_element_reference.html
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’

It sounds like the first click modified the list. If the click causes the list to change then you may need to refresh your test objects because they no longer represent the elements they once did.

Please provide more info - follow this advice: