cancel
Showing results for 
Search instead for 
Did you mean: 

Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

SOLVED
Occasional Contributor

Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

Bit of an unusual one here and i'm very confused.

 

The below code is run and searches for and selects the menu item detailed.

The code is used several times in a loop to build a system, so it searches and selects, 'Color', 'Projection', Wall Height' etc.

 

Oddly on the 7th and 8th loop system it builds, it searches for 'Flooring' finds it, but then can't select it as it reports it is waiting for it to be visible on screen.

 

What is strange is that i can see it on screen, it knows it is there as it fails at the touch command, using the object spy reports it as being visible on screen, but for some reason the Watch details for it show as False for Visible on screen.

 

Of the 16 systems it builds it is fine for all the rest

 

2019-06-20_1519.png

 

procedure Find_Label_Touch(ControlName : String; Driver: OleVariant);
var
  target_CollectionView;
  target_Label;
  Value;
begin
  Value := Project.Variables.Driver.Value(ControlName);
  If Value <> 'Blank' then 
  begin
    target_CollectionView := Aliases.Device.processApplication.window0.tableview0;
    target_Label := target_CollectionView.Find( ['ObjectType', 'ObjectText'], ['Label', Value], 20000);
    target_Label.Touch();
    Delay(500);
  end;
end;
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Occasional Contributor

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

Thank you both and apologies for the late feedback.

 

I have a feeling that it is some sort of delay in the screen displaying what it is looking for although i am not sure why it is only affecting that particular menu item, since they all run the same code, just with a different param to tell it what text to search for. I have increased my delays in the script and it appears to now be fine for 15 out of 16 loops.

 

Thank you both for the input as it gave me other avenues to look at.

View solution in original post

5 REPLIES 5
Community Leader

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

I have seen that behavior before on complex 3rd party controls, which looks like that is the case here.

With complex controls like the menu you are using, the developers are using the internal collection of the object, display it on the screen, then remove the object from memory on purpose or the garbage collector removes it in Java or .NET as the UX portion of the control is not referenced again anywhere.

 

So in you case, the collection is there but the labels are not.  I know you can see the labels on the screen and that is part of the rendering the control is doing but the objects are no longer there, so the "Touch" on the label is failing.

 

These type of issues can be resolved in one of 3 ways:

1- Fire the click procedue on the Collection item itself in script

2- Low Level Procedure to click on the label on the screen which will trigger an event even though the object underneath it is not in memory

3- Use the new OCR (Artificial Intelligence) in TestComplete 12.5 and 14 to recognize the label text in the menu and fire a click command on it.

 

Hope that helps

-Lino

Community Hero

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

Hi,

 

> object spy reports it as being visible on screen, but for some reason the Watch details for it show as False for Visible on screen.

 

VisibleOnScreen is a property that should be used with caution... As it is said in the documentation, VisibleOnScreen is set to True only when the object is visible on screen at the given moment of time. Which means that if the object (control) is overlapped (for example, by TestComplete's UI), its VisibleOnScreen will be set to False. (And back to True if you switch back to the tested application itself). This fact makes debugging of the code that uses VisibleOnScreen a bit problematic (unless you have more than one monitor, so that your tested application is always visible).

One more thing - VisibleOnScreen originates from desktop/web support and personally I would be not much surprised if it has some side effects/specifics on mobiles.

Another thing to consider: wasn't the tested menu scrolled in some way before test code attempted to touch its Flooring item? If it was, then using what means? If the scroll was done from test code via the direct call to some native methods, then it could be that scroll action was not noted by TestComplete and it still considers menu item as not visible on screen.

And the last one for the moment: try to examine in the Object Browser objects that are close to the problematic menu item. It is quite possible that, for example, the item with the Autumn Landscape text overlaps menu item and thus it is considered as not visible on screen. (For example, it may be not clear to TestComplete that the text has transparent background which makes menu item to be visible.)

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Highlighted
Occasional Contributor

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

Thank you both and apologies for the late feedback.

 

I have a feeling that it is some sort of delay in the screen displaying what it is looking for although i am not sure why it is only affecting that particular menu item, since they all run the same code, just with a different param to tell it what text to search for. I have increased my delays in the script and it appears to now be fine for 15 out of 16 loops.

 

Thank you both for the input as it gave me other avenues to look at.

View solution in original post

Occasional Visitor

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.


@MyPrepaidBalance wrote:

Thank you both and apologies for the late feedback.

 

I have a feeling that it is some sort of delay in the screen displaying what it is looking for although i am not sure why it is only affecting that particular menu item, since they all run the same code, just with a different param to tell it what text to search for. I have increased my delays in the script and it appears to now be fine for 15 out of 16 loops.

 

Thank you both for the input as it gave me other avenues to look at.


Which means that if the object (control) is overlapped (for example, by TestComplete's UI), its VisibleOnScreen will be set to False. (And back to True if you switch back to the tested application itself). This fact makes debugging of the code that uses VisibleOnScreen a bit problematic (unless you have more than one monitor, so that your tested application is always visible).

One more thing - VisibleOnScreen originates from desktop/web support and personally I would be not much surprised if it has some side effects/specifics on mobiles.

Another thing to consider: wasn't the tested menu scrolled in some way before test code attempted to touch its Flooring item? If it was, then using what means? If the scroll was done from test code via the direct call to some native methods, then it could be that scroll action was not noted by TestComplete and it still considers menu item as not visible on screen.

Occasional Contributor

Re: Menu not selected as TC reports as not visible on screen, but i'm looking right at it.

Hi Linda 95.

 

The item in question is always visible on screen and doesn't need to be scrolled on the ipad in question.

I am lucky enough to have 3 monitors on my main machine, so i use 1 specifically for running tests to avoid the possibility of an over lapping window from another application.

 

It could just be down to the fact that as you mention it had a side affect using visible on screen against a mobile device.

 

Could be due to a lag with the TC Mobile Screen viewer as i'm not sure if TC is using that to view items or actually running on the device itself.