Recognizing elements on a TabControl

Ranorex Studio, Spy, Recorder, and Driver.
User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Recognizing elements on a TabControl

Post by Support Team » Tue Oct 30, 2012 4:45 pm

Hello,

Could you please send us the whole project?
Thank you!

Regards,
Bernhard

e.boyle
Posts: 5
Joined: Wed Jul 11, 2012 12:08 pm

Re: Recognizing elements on a TabControl

Post by e.boyle » Tue Oct 30, 2012 4:50 pm

Find attached the whole project.
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Recognizing elements on a TabControl

Post by Support Team » Wed Oct 31, 2012 5:41 pm

Hello,

Thank you for the project. We will take a look at this issue and will get back to you as soon as possible.

Regards,
Bernhard

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Recognizing elements on a TabControl

Post by Support Team » Tue Nov 06, 2012 11:32 am

Hello,

It seems to be an issue if the Target Framework setting is set to '.NET Framework 4.0'. I changed the setting to '.NET Framework 3.5'. After doing that, Spy was able to recognize the buttons inside the Tab Control.

Regards,
Bernhard

e.boyle
Posts: 5
Joined: Wed Jul 11, 2012 12:08 pm

Re: Recognizing elements on a TabControl

Post by e.boyle » Tue Nov 27, 2012 11:33 am

I am able to see the controls following the suggestion at,

http://social.msdn.microsoft.com/forums ... 436E99797F

I created a custom peer and if I start my application and then start Ranorex SPY I can see the elements. If however I start Ranorex studio and then start the application I still can't see those items. It's not until a close Ranorex and kill the bridge process that I can then see the elements again in Spy.

This also means that my iUI test fails as it can't see my control.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Recognizing elements on a TabControl

Post by Support Team » Wed Nov 28, 2012 8:36 am

Hello,

It seems to be an issue in the .NET 4.0/4.5 version in relation to the 'Tab Control' template.
We changed your XAML code a bit. Please try the following one. The behavior of your application should be the same.
<TabControl BorderThickness="0" x:Name="UnseenTabControl" SelectedIndex="{Binding ElementName=SelectedPage, Path=SelectedItem}" OverridesDefaultStyle="False">
<TabControl.Resources>
	<Style TargetType="TabItem">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="TabItem">
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</TabControl.Resources>
<TabItem>
	<Grid>
		<Button Name="OnPage3">OnPage1</Button>
	</Grid>
</TabItem>

<TabItem>
	<Grid>
		<Button Name="OnPage4" Margin="20" AutomationProperties.AutomationId="ButtonUAID">OnPage2</Button>
		<Expander>
			<Button Name="InsideExpander2">InsideExpander2</Button>
		</Expander>
	</Grid>
</TabItem>
</TabControl>
I hope this will help you!

Regards,
Bernhard

IlkerS
Posts: 3
Joined: Wed Feb 20, 2013 4:12 pm

Re: Recognizing elements on a TabControl

Post by IlkerS » Wed Feb 20, 2013 4:29 pm

Hello Bernhard,

I have also severe problems with having Ranorex and Ranorex Spy recognizing the controls of our application reliably and I did not know that this has probably something to do with prolems in TabControls in .NET4.0. Sometimes the contained controls are found and sometimes they are not found and are forgotten etc.. It is my misfortune that the whole application starts with a TabControl in a Grid and uses sub TabControls to navigate, i.e. it is an application founded on tab navigation and I have to test its GUI in an automated way with Ranorex :x . Your last post is a code suggestion to someone how to circumvent this problems. I don't know the code of the other user, so can you tell me which code you modified and why you modified it? If your modifications include the part with the style for the template (as shown below) then I must say that I cannot apply this modification to my code because it clips all the images in my tab items headers away and perhaps has other side effects too. So can you tell me what I can do?

Code: Select all

<TabControl.Resources>  
    <Style TargetType="TabItem">  
        <Setter Property="Template">  
            <Setter.Value>  
                <ControlTemplate TargetType="TabItem">  
                </ControlTemplate>  
            </Setter.Value>  
        </Setter>  
    </Style>  
</TabControl.Resources>

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Recognizing elements on a TabControl

Post by Support Team » Mon Feb 25, 2013 5:01 pm

Hello,

In order to analyze your issue I would need more information. Could you please send us a Ranorex snapshot file of your application. If it is possible it would be very helpful to get your application or a similar application to reproduce this behavior. The original source of XAML code can be found on the first page of this thread (http://www.ranorex.com/forum/recognizin ... -t647.html).

Regards,
Bernahrd