none
UIAutomation Disapears on second or third call

    Question

  • Hello,

    I'm working on using UIAutomation on a Flash app. Trying to get the UI objects from outside of a flash app that runs in a browsers.

    Everything is working fine. In other words, I find all the objects when I run the code below from my c# program.

    The problem is when I try to run  it a second or third time. In other words I try to get the objects a second or third time using the code below.

    Most of the time on the second or third try of getting the objects the code returns zero objects. It always work on the first try though.

    Anyone have any thougts on anything I should try. It's a very frustrating problem.

    Things I have already tried

    Tried running it in separate thread.

    Tried running the code outside of debug

    Nothing seems to work.

    Condition conditions = new AndCondition(
                  new PropertyCondition(AutomationElement.IsEnabledProperty, true),
                  new PropertyCondition(AutomationElement.IsOffscreenProperty,
                      false)
                  );

                AutomationElementCollection elementCollection =
                    RootElement.FindAll(TreeScope.Children, conditions);

    If anyone has any thoughts or ideas I would really appreciated it.

    Thanks in advance

    Allen

    Friday, May 24, 2013 2:44 PM