Reusing an Adapter object for visibility checks
Posted: Mon Jul 13, 2015 2:22 pm
Hi,
Is it possible to reuse a already generated Adapter object for visiblity checks? because currently I'm observing the following behavior: The value of the Visibility flag of an Adapter object does not change after the object was created even if the application under test shows the element. (This seems to be either intended behavior or it is a bug).
The follwoing demo code should explain it:
All log entries generated within the loop show that the Visible flag was set to false for ca 10 seconds even if the element was displayed after 2-3 seconds (at the application under test). Only after recreating the object the value changed to true.
The caching setting of the repository was completely switched off (at least all available RepoGenBaseFolder.UseCache flags were set to false).
So I'm
- either misusing this flag
- or found a bug
- or there is a internal cache within Ranorex which cannot be controlled by setting RepoGenBaseFolder.UseCache
- or I'm missing a configuration somewhere
I'm currently using Ranorex 5.2.2 on a Win7x64 machine using .NET 4.0.
Some Background information:
The reason for trying to reuse a already created object is that it seems to be expensive (time consuming) to create adapter instances especially for complex repository structures. So the idea was to create the object only once (before the loop starts) and reuse the object within the loop.
Is it possible to reuse a already generated Adapter object for visiblity checks? because currently I'm observing the following behavior: The value of the Visibility flag of an Adapter object does not change after the object was created even if the application under test shows the element. (This seems to be either intended behavior or it is a bug).
The follwoing demo code should explain it:
public void Demo(RepoItemInfo item) { Report.Log(ReportLevel.Info, "Starting demo..."); WebElement element = item.CreateAdapter<WebElement>(true, new Duration(5000)); for( int i = 0; i < 10; i++) { Report.Log(ReportLevel.Info, "Element visible: " + element.Visible); Delay.Milliseconds(1000); } Report.Log(ReportLevel.Info, "Loop done... "); element = item.CreateAdapter<WebElement>(true, new Duration(5000)); Report.Log(ReportLevel.Info, "Element visible: " + element.Visible); }The resulting report always looks like:
Code: Select all
00:00 | Info | Starting demo...
00:01 | Info | Element visible: false
00:02 | Info | Element visible: false
00:03 | Info | Element visible: false
00:04 | Info | Element visible: false
00:05 | Info | Element visible: false
00:06 | Info | Element visible: false
00:07 | Info | Element visible: false
00:08 | Info | Element visible: false
00:09 | Info | Element visible: false
00:10 | Info | Element visible: false
00:11 | Info | Loop done...
00:12 | Info | Element visible: true
The caching setting of the repository was completely switched off (at least all available RepoGenBaseFolder.UseCache flags were set to false).
So I'm
- either misusing this flag
- or found a bug
- or there is a internal cache within Ranorex which cannot be controlled by setting RepoGenBaseFolder.UseCache
- or I'm missing a configuration somewhere
I'm currently using Ranorex 5.2.2 on a Win7x64 machine using .NET 4.0.
Some Background information:
The reason for trying to reuse a already created object is that it seems to be expensive (time consuming) to create adapter instances especially for complex repository structures. So the idea was to create the object only once (before the loop starts) and reuse the object within the loop.