Losing recognition of a window

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
rannytester
Posts: 3
Joined: Wed Oct 21, 2015 10:25 pm

Losing recognition of a window

Post by rannytester » Thu Oct 22, 2015 2:55 pm

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
Last edited by rannytester on Thu Oct 22, 2015 3:25 pm, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Losing recognition of a window

Post by odklizec » Thu Oct 22, 2015 3:24 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

rannytester
Posts: 3
Joined: Wed Oct 21, 2015 10:25 pm

Re: Losing recognition of a window

Post by rannytester » Thu Oct 22, 2015 3:40 pm

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?

rannytester
Posts: 3
Joined: Wed Oct 21, 2015 10:25 pm

Re: Losing recognition of a window

Post by rannytester » Thu Oct 22, 2015 8:10 pm

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.