dotnet-client
dotnet-client copied to clipboard
Explicit wait not ignoring exceptions
I feel like I'm missing something fundamental, as the explicit wait feature doesn't seem to actually ignore exceptions no matter what I try. I also never see my condition executed more than once, even if the timeout is 60 seconds and the polling interval is 1 second. Does this feature work at all or am I misusing it?
var wait = new WebDriverWait(Session, TimeSpan.FromSeconds(120));
wait.IgnoreExceptionTypes(typeof(Exception));
wait.Until(s =>
{
var tree = Session.FindElementByXPath("//Tree[@Name='Solution Explorer']");
return tree.FindElementByXPath("//TreeItem[@Name='Acme4301']");
});
Hi @akinsolb ,
Any work at all on this issue? It's been quite a while and never received any response at all.
Thanks very much in advance.
@kfertitta Will look into it this week
@akinsolb something I can give a hand with here?
Duplicate of https://github.com/appium/appium-dotnet-driver/issues/225
@Dor-bl Are you sure this is a duplicate of #225 ? The behavior described there is not what I'm seeing and the only thing I saw there as a resolution was use of ignored exceptions, which I'm already doing.
I reopened. @akinsolb said he will take a look
@kfertitta after reviewing your issue with selenium collaborator, this is the expected behavior. In his words : It's absolutely expected behavior. The WebDriverTimeoutException can't be ignored by the WebDriverWait. The condition not bing met before the timeout expires is an exceptional condition, as you're explicitly waiting for the condition to be truthy (return true or non-null), and thus, when the timeout expires without the condition being met, throwing an exception is the proper behavior.
So you should basically wrap your code with try-catch and handle it the way you want.
@Dor-bl Thank you very much for the follow-up. I see then from your comments that it's just that particular exception that can't be ignored.
Correct, I'll keep this issue open for now . I'll add a test integration for this aspect in the coming days.
Pushed a PR for adding related coverage: https://github.com/appium/dotnet-client/pull/555