Я пытаюсь сделать функцию для перехвата org.openqa.selenium.NoSuchElementException, и вот моя реализация в scala:
def doesElementExists() = {
try {
//as long as isDisplayed() returns a boolean value, it means the element exists in the html code
seleniumElement.isDisplayed()
true
} catch {
case element_not_found_exception: org.openqa.selenium.NoSuchElementException => {
false
}
}
}
Однако, как только я проверяю несуществующий элемент, которыйЯ ожидаю, что функция вернет false, она сдуется и отбросит
org.openqa.selenium.NoSuchElementException,
: Unable to locate element: {"method":"id","selector":"nonexistent-element"};
Мне интересно, почему блок catch не обработал исключение?