/*
NoSuchElementException is thrown when we try to access an element
that does not exist in a list through an iterator, as illustrated below.
*/
import java.util.ArrayList;
import java.util.List;
public class NoSuchElementExceptionDemo {
public static void main(String[] args) {
List<Integer> list = new ArrayList<>();
// The below statement generates a NoSuchElementException
// The iterator cannot access the non-existent element
System.out.println(list.iterator().next());
}
}
from selenium.common.exceptions import NoSuchElementException
except NoSuchElementException:
# handle the element not existing