This question is locked. New answers and comments are not allowed.
I have an img element that's updated via an ajax call. I want to wait until the onclick attribute contains the text "OpenMailingList". I used the Verification Builder to create an attribute verification step, changed it to a Wait Step in Visual Studio, and finally changed it to a code-behind step. It generated the following code:
This code fails immediately at runtime because c.AssertAttribute throws an exception (the text doesn't match yet) and the For method apparently doesn't catch it.
Is the generated code wrong? Or is there a bug in the For method? (e.g., it should handle the exception.) Or maybe the bug is in my understanding of how Wait.For is supposed to work!
In the meantime, I replaced the generated code with this, which is working fine but is not a great solution because it doesn't leverage the element that is already defined in the element repository.
Thanks for any clarification you can provide.
Chris
HtmlImage ListsLookupButton = Pages.PortalEditSegmentPage.ListsLookupButton;
Wait.For<
HtmlImage
>(c => c.AssertAttribute().Value("onclick", ArtOfTest.Common.StringCompareType.Contains, "OpenMailingList"), ListsLookupButton, 10000);
This code fails immediately at runtime because c.AssertAttribute throws an exception (the text doesn't match yet) and the For method apparently doesn't catch it.
Is the generated code wrong? Or is there a bug in the For method? (e.g., it should handle the exception.) Or maybe the bug is in my understanding of how Wait.For is supposed to work!
In the meantime, I replaced the generated code with this, which is working fine but is not a great solution because it doesn't leverage the element that is already defined in the element repository.
ActiveBrowser.WaitForElement(10000, "tagname=img", "onclick=~OpenMailingList");
Thanks for any clarification you can provide.
Chris