Functional testing - Selenium WebDriver

15
Hi everyone,   I'm doing functional testing using selenium webdriver and I'm having issues when locating WebElements. It's totally random and it is not related to the selector used to capture the element.   I edited capture functions to wait till the element is actually visible and then to perform the desired action, (I tried all imaginable and possible types of wait), but it turns out that it's not enough: the DOM renders multiple times even after "complete" page loading and might impact my element location statement. So even when my visibility condition is fulfilled and that my action is "allowed" to be executed, it might fail.  We tried Selenium IDE and the result was the same: randomly failing at different places.   The explanation the team got is that there is a sync issue between the moment we capture the element and the action execution related to it. Capturing an element has a condition to wait for its actual visibility, but while passing to the next statement which is performing the desired action, the DOM might be destroyed and re-rendered, implying that we're no more capturing the same element and that the one we're looking for is no longer valid.   has anyone had the same problem before? And  how did you get around it? Is there a simple way to safely perform an action (being sure that the element we’re trying to locate is actually there) and that the previous action is indeed completed?   Thank you all!
asked
4 answers
3

My advice would be to use ATS for functional testing.

For more info check https://docs.mendix.com/addons/ats-addon/

answered
1

Finding the right way to WAIT in a test case is one of the hardest aspects of writing UI tests with selenium. This is emphasized by the fact that the Mendix runtime is essentially a black box.
With Mendix you can never be sure that the runtime is not busy processing some microflow that when finished will trigger a refresh on the page and invalidate your selectors.

The result is the dreaded stale element exception – https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium

I have no definitive solution for you but do take a look at FluentWait – https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/support/ui/FluentWait.html

Retries also might help.

answered
0

Long time ago I tried to use Selenium with Mendix but without good results. I had similar problems.

answered
0

I have the same issue!

answered