It works if I run full pipline, but if I want to run a unit test, I need to assign value to “MainWindow”.
I can retrieve value from “watch”.
but how can I assign it into a variable manually when I do the Test Activity. Pasting the text I retrieved seems does not work. Does anyone know how to assign UiElement manually?
We might be able to create UiElement instance statically. However, as UiElement has several parameter which is related with the target application such as ProcessID etc, it will make no sense in practical.
In this case, it’s better to use driver xaml which include UseApplication activity etc, then call the test target xaml from the driver.
Thanks, but I think that’s what I am doing now. I want to do unit test which means I don’t want to add another active to get the element. I want to use the one I got before.
For example, It’s necessary to have same PID with the actual running application. Even if we assign some value as PID, PID of target application might be changed at next run, and it make no sense.
Thanks, may I ask what do you mean “next run”? Is run for UiPath or run for the target window?
Since I just want to do unit test, if the answer is the later(according to Immediate I think so), it still makes sense for me.
But in practice, is it possible to assign a new UiElement with several attributes? or is it possible keep the instance in memory and read it again when next test?
We want to create a robot to do series operations on an application.
Here is my plan of UiPath (Main.axml),
Open the application (output the UiElement “MainWindow”)
Do operation A on “MainWindow”
Do operation B on “MainWindow”
Do operation C on “MainWindow”
Do operation D on “MainWindow”
…
So when I developing operation X, I’d like to do TestActivity for operation X.
Because I have opened the application at step1, I don’t want to close it and open it again to just get the UiElement instance. (The application require a long time to initialize)
The workaround is adding a FindElement before “Do operation X on “MainWindow”” to get the window of the opened application like Lak_Ui said. It works but I need to removed it after finishing test, so I want to find a smarter way to do the TestActivity.