I need to wait for an element to disappear from the screen. I know how to wait for an element to be visible, I used the code below:
wait.until(conditions.presenceOfElementLocated(pkg.By.xpath("mainLoadingDialog")))
Now I just need to do the opposite and wait until the element is not visible anymore.