Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebDriverWait Exception only thrown in Debug Mode in Visual Studio 2015

I was wondering if anyone else has encountered a similar problem like this or has experiences using WebDriverWait?

If they would know why I get a NoSuchElementException which seems to only be thrown in debug mode. I don't get this error being thrown when running the test in normal runtime.

I am able to click continue and step past the exception also.

enter image description here

like image 689
Taran Avatar asked Feb 20 '17 10:02

Taran


People also ask

How do I fix unhandled exception in Visual Studio?

To change this setting for a particular exception, select the exception, right-click to show the shortcut menu, and select Continue When Unhandled in User Code. You may also change the setting for an entire category of exceptions, such as the entire Common Language Runtime exceptions).


1 Answers

I believe this is a quirk of Visual Studio's debug mode. Essentially in debug mode exceptions are sometimes treated as a break even if it is appropriately handled within a try/catch.

Remember when you pass a func to Until() in WebDriver, that func is executed internally within a try. VS is likely hitting the (handled) exception in that method, which is why you do not see it during normal running.

See here for more info.

like image 74
Escape17 Avatar answered Nov 14 '22 22:11

Escape17