Page 1 of 1

Losing recognition of a window

Posted: Thu Oct 22, 2015 2:55 pm
by rannytester
The scope of my test is to launch a window by clicking an icon, select an item in a combobox, save and close, and then repeat that again. The first run-through works perfectly fine, the attempted repeat does not and it's the exact same code.

Steps to reproduce:

Click icon to launch new window
Select a value from a combobox in the new window
Select 'save and close', the window will close
Click icon again to launch same window

At this point, ranorex can't interact with that combobox again. Manually the combobox is visible and able to be interacted with. The test errors out with this message:

Setting attribute 'text' failed on element '{ComboBox:cboName}'.
Failed to serialize return data from remote process.

Some clues I've found:
If I use a Combo.click on the combobox at the time, ranorex tries to click the upper-left corner of the desktop.
If I add a breakpoint and spy on the combobox, the spy tells me the combobox is valid and visible. However, if I use Combo.valid and Combo.visible, those both return false.
If I then go into my repository, select the combobox from the list and click 'Highlight selected repository item', a search dialog appears, searches for about 3-5 seconds and then eventually correctly highlights the combobox.
If I break this test in half and simply run it twice in a row, it works as expected.

Could anyone offer some advice? I'm using ranorex 5.4.2.25689

Re: Losing recognition of a window

Posted: Thu Oct 22, 2015 3:24 pm
by odklizec
Hi,

Have you tried to disable folder caching? In repository, select the folder containing the combobox, then in properties list set "Use Cache" to False.

Re: Losing recognition of a window

Posted: Thu Oct 22, 2015 3:40 pm
by rannytester
Thank you for the suggestion, unfortunately I still get the same result and error.

It would make sense that the cache could play a role considering splitting this test into two tests is able to run fine.

Any other advice?

Re: Losing recognition of a window

Posted: Thu Oct 22, 2015 8:10 pm
by rannytester
So I think I've determined the problem. The code I was using:

Code: Select all

var Activity_Combo = repo.<xpath>_Combo;
Activity_Combo.Focus();
Activity_Combo.Text = "Some text";
After closing and re-opening that window later in the test, I was using that same exact code without setting the variable to the repository object again. So before the part of the test where the repeat happens, I just needed to add

Code: Select all

Activity_Combo = repo.<xpath>_Combo;
If anyone cares to explain why, I'd love to hear it. Sounds like I need to brush up on my C# and OOP.