Reusing an Adapter object for visibility checks

Class library usage, coding and language questions.
Posts: 2
Joined: Mon Sep 13, 2010 9:59 am

Reusing an Adapter object for visibility checks

Post by bbarbisch » Mon Jul 13, 2015 2:22 pm


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);
    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
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.

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

Re: Reusing an Adapter object for visibility checks

Post by odklizec » Mon Jul 13, 2015 3:35 pm


I cannot reproduce such problem with Ranorex 5.4, but it may be that the problem is reproducible only with specific HTML element?

Could you please try to reproduce the problem with latest Ranorex 5.4 (even in trial mode)? And if the problem is still reproducible, please post a Ranorex snapshot of the element in question. Eventually, please post a sample HMTL, with which we can try to reproduce the issue.

Also, what browser are you using? Have you tried it with different browser?
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