Can't find an element by name in a wpf application

I am running appium (with c#) and I have a window that have a combo box and the problem is like so:
after the window open for the first time, I click the combo box and go to the next window and then go back to the first window and try the same action again, but at the second time appium can’t find it (no matter how much time I gave it - 100+ sec) when pausing my code and checking the elements names in snoop everything sames to be in order and the names are correct, so what is the problem here?

1 Like

hmm could you share the element value of your combo box? also the code that identifies it?

Hi, I found the problem, it was because I use ‘FindElement’ for the combo box just on the first time(and save it after the first time) when I change my code to find the combo box on every time it fixed that.

I don’t understand why it so?
tnx for the help

1 Like

hmm seems weird… As some days have passed since your question, did you find the reason it happened?

I still don’t why is it like that, but as I see it, the element that relevant for a screen is unique for a specific session of this screen, and when closing and opening again the same screen a new element need to be created for the new session, in order to control it.