Need some help with Automation Tests

1
Hi guys,   Been struggling a bit with automation tests. It has been working for the most time. As the tests have gotten bigger and more “complex” I get this error every now and again: org.openqa.selenium.StaleElementReferenceException: The element reference of <some element> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed.   I’m using WebDriverWait to wait for the visibility of the element before clicking or asserting. My tests doesn’t fail at one specific spot, but at random places throughout the test suite.   Thanks Jean    
asked
2 answers
2

Hi Jean,

Have you heard of ATS? It is an add on for the Mendix platform for automating your Test scripts. You can easily record test cases and run than, manually, scheduled or by a external trigger.

 

ATS has standard wait functions build in for every step you record and run.

If you need more info, check the Mendix Website or contact me directly. I can arrange a short demo

 

Greetings,

 

Marcel Janssen

marcel.janssen@mansystems.nl

https://docs.mendix.com/addons/ats-addon/

 

answered
1

Sounds like a though one to resolve. I did find this on stackoverflow: https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium#12967602 which is suggesting  a workaround by retrying a couple of times. The second answer might be helpful:

new WebDriverWait(driver, timeout)
    .ignoring(StaleElementReferenceException.class)
    .until(new Predicate<WebDriver>() {
        @Override
        public boolean apply(@Nullable WebDriver driver) {
            driver.findElement(By.id("checkoutLink")).click();
            return true;
        }
    });

or is that exactly what you have done with webdriverwait already?

answered