Page 1 of 1

Could not get a valid element rectangle

Posted: Sat Nov 05, 2016 1:49 am
by c676228
Hi Folks,

This code has been working fine for about a year. However it really acts up recently:
TrTag row=FindMatchRow(serialNumber); //the row can be found without a problem
SelectADevice(row); //however, the row seems getting invalid gradually:

public bool SelectADevice(TrTag row)
{
if ( row != null) //ok
{
if(!row.Element.GetAttributeValueText("class").Contains("selected")) //ok
{
row.MoveTo(300); //ok
row.Click(); //get a warning message 1) specified below
//wait for a while ...
return true;
}
}
return false;
}


1) Warn Automation:Could not get a valid element rectangle from '{TrTag:}', since the element is no longer valid.
Later on, use this row to find its child will give this error:
No element found for path 'td[4]/div/span[2]' within 30s.

similar issue:
2) Could not get a valid element rectangle from '{SpanTag:}', since the element is no longer valid.
Action 'performclick' failed on element '{SpanTag:}'.
Later on use this spantag to find its child will have this error:
Error in MsgHostDom call: Error TypeError: node is undefined @resource://rxautong-at-ranorex-dot-com/data/../page.js:585:13 @resource://rxautong-at-ranorex-dot-com/data/../page.js:109:17

can someone shed a light?

Re: Could not get a valid element rectangle

Posted: Mon Nov 07, 2016 4:31 pm
by krstcs
My guess would be that the indexes of the td[4] or span[2] elements in your path have changed in the AUT. It is best practice to NOT use indexes (the numbers in the brackets by themselves like '[4]' or '[2]'). You should instead use an actual attribute.

Change 'td[4]/div/span[2]' to 'td/div/span' in your path, or, preferably, find a suitable attribute to use for identification.

Re: Could not get a valid element rectangle

Posted: Tue Nov 08, 2016 12:50 am
by c676228
Hi Krstcs,

I checked many times. The UI items are not changed. it seems there are some 32bit and 64bit confusing.
I created project on windows 8, no build issue and when I moved the project to windows 2012R2
I see the following warnings in Ranorex Studio(5.4.6). Meanwhile from time to time I see the bit-bridge error, see the attachment. All my machine is 64-bit( the automated testing is web app, not windows app).
Actually both .net framework 4.5 and .net sdk are installed on windows 2012r2.

1.
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of
the reference "System.Web", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor
architecture of your project through the Configuration Manager so as to align the processor architectures between your project
and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture
of your project.
(MSB3270)

2.
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor
architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider
changing the targeted processor architecture of your project through the Configuration Manager so as to align the
processor architectures between your project and references, or take a dependency on references with a processor
architecture that matches the
targeted processor architecture of your project. (MSB3270)

3.
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of
the reference "C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures.
Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to
align the processor architectures between your project and references, or take a dependency on references with a processor
architecture that matches the
targeted processor architecture of your project. (MSB3270)

4.
The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this,
install the SDK or Targeting Pack for this framework version or retarget your application to a version of
the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved
from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly
may not be correctly targeted for the framework you intend.