Closed mkuzmina-lohika-tix closed 6 years ago
When trying to use
catch (NoSuchElementException | TimeoutException e) {
got a compilation error:
Error:(209, 39) java: multi-catch statement is not supported in -source 1.5
(use -source 7 or higher to enable multi-catch statement)
The suggestion is to use only
catch ( TimeoutException e) {
that should be enough for wait.until() construction @marinamv has proposed
Done. I left 2 exceptions protected boolean isElementPresent(By locator) { logger.info("WAIT ELEMENT TO BE PRESENT: " + locator); try { (new WebDriverWait(driver, defaultExplicitWaitInSeconds)) .until(ExpectedConditions.presenceOfElementLocated(locator)); return true; } catch (NoSuchElementException e) { return false; } catch (TimeoutException e) { return false; } }
Add waiting