仅在Visual Studio 2015的调试模式下引发WebDriverWait异常 [英] WebDriverWait Exception only thrown in Debug Mode in Visual Studio 2015
问题描述
我想知道是否还有其他人遇到过类似的问题或有使用WebDriverWait的经验?
I was wondering if anyone else has encountered a similar problem like this or has experiences using WebDriverWait?
如果他们知道为什么我会收到一个NoSuchElementException,它似乎仅在调试模式下抛出。在正常运行时运行测试时,不会出现此错误。
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.
推荐答案
是Visual Studio调试模式的怪癖。本质上,在调试模式下,即使在try / catch中适当地处理了异常,有时也会将其视为中断。
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.
在将函数传递给WebDriver中的直到()时,请记住,该func会在内部尝试执行。 VS可能会在该方法中遇到(已处理的)异常,这就是为什么您在正常运行期间看不到它的原因。
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.
这篇关于仅在Visual Studio 2015的调试模式下引发WebDriverWait异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!