To wait for an element to exist, you have to do this:
In my silverlight application, at some point I have to wait for either elementA to exist or elementB to exist. So I created two tasks that each wait for one of the elements to exist:
with WaitForElement() being:
I thought this would be a good way to find out which one of the two elements show up. However, when I run this code, neither element will ever be found, even though they do show up.
Anybody has any ideas?
var element = app.FindName(
"element"
);
element.Wait.ForExists();
In my silverlight application, at some point I have to wait for either elementA to exist or elementB to exist. So I created two tasks that each wait for one of the elements to exist:
var waitForElementATask = Task.Factory.StartNew(() => WaitForElement(
"elementA"
));
var waitForElementBTask = Task.Factory.StartNew(() => WaitForElement(
"elementB"
));
Task.WaitAny(waitForElementATask ,waitForElementBTask);
with WaitForElement() being:
private
void
WaitForElement(
string
name)
{
var element = app.FindName(name);
element.Wait.ForExists();
}
I thought this would be a good way to find out which one of the two elements show up. However, when I run this code, neither element will ever be found, even though they do show up.
Anybody has any ideas?