为了检查是否存在Element和clickble,我尝试编写一个布尔方法,该方法将等待使用C#硒的webDriverWait启用和显示该元素,如下所示:
webDriverWait等待=新的webDriverWait(驱动程序,timeSpan.fromSeconds(60));
Wait.untill(d => webElement.enabled()&& webElement.displayed());
如果以上条件没有发生,我希望该方法返回“ false”。问题是我抛出了异常。如果抛出异常,如何忽略诸如noSuchElementException和timeOutException之类的异常?我尝试使用try catch块,但是它没有帮助,并且引发了异常。