selenium - IgnoreExceptionTypes does not work (C# Webdriver) -


i have found in c# whether using webdriverwait class or defaultwait class, in either case ignoreexceptiontypes method appears not work.

i.e. in either case when running against page staleelementreferenceexception thrown despite fact instructing code ignore these exceptions.

webdriverwait example :

public void waitelementtobeclickable(iwebelement element)     {         var wait = new webdriverwait(driver, timespan.fromseconds(60));         wait.ignoreexceptiontypes(typeof(nosuchelementexception), typeof(staleelementreferenceexception));         wait.until(expectedconditions.elementtobeclickable(element));     } 

defaultwait example :

public iwebelement safewaitfordisplayed(iwebelement webelement) {      var w = new defaultwait<iwebelement>(webelement);             w.timeout = timespan.fromseconds(30);             w.ignoreexceptiontypes(typeof(nosuchelementexception), typeof(staleelementreferenceexception));             return w.until(ctx =>             {                 var elem = webelement;                 if (elem.displayed)                     return elem;                 else                     return null;             });     } 

any suggestions gratefully received. there appears little on web usage of particular method , others have found not work no workarounds suggested.

the ignoreexceptiontypes last throughout wait until times out. using defaultwait , expecting return null. not. when timeout reached throw exception. consequently have enclosed in try catch handle exception appropriately on timeout.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -