1
私はorg.openqa.selenium.NoSuchElementExceptionをキャッチする機能をしようと、ここでスカラ座での私の実装でいます:セレンのisDisplayed()からNoSuchElementExceptionをキャッチしますか?
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
}
}
}
しかし、できるだけ早く私は、私が期待している、存在しない要素をチェックして偽を返す関数は、catchブロックが例外を処理しませんでした、なぜ私が疑問に思って吹き飛ばすとバック
org.openqa.selenium.NoSuchElementException,
: Unable to locate element: {"method":"id","selector":"nonexistent-element"};
を投げますか?