Exception on trying to get TabPage

Apr 10, 2008 at 5:23 PM
I'm getting the following exception on trying to get the tabpage in your WPF test application with the following code:

Core.UIItems.TabItems.TabPage tabPage = WPFTestMainWindow.Get<Core.UIItems.TabItems.TabPage>(SearchCriteria.ByAutomationId("Autumn"));

Any ideas?

Thanks

James
---
at Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\UIItemContainer.cs:line 88
at Core.UIItems.UIItemContainer.GetT(SearchCriteria searchCriteria) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\UIItemContainer.cs:line 69
at WPFTestApp.Test.ExercisingWhite.GetTabs() in C:\QA\projects\NGDT\Tools\White\v014\WPFTestApp\Tests\Test.cs:line 269
--MemberAccessException
at System.Reflection.RuntimeConstructorInfo.CheckCanCreateInstance(Type declaringType, Boolean isVarArg)
at System.Reflection.RuntimeConstructorInfo.ThrowNoInvokeException()
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at Bricks.RuntimeFramework.Class.New(Object[] arguments) in D:\bricks\Bricks.RuntimeFramework\Class.cs:line 77
at Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, Type customItemType, ActionListener actionListener) in c:\cruisecontrolrb\projects\white\work\Core\Factory\DictionaryMappedItemFactory.cs:line 27
at Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener) in c:\cruisecontrolrb\projects\white\work\Core\Factory\DictionaryMappedItemFactory.cs:line 15
at Core.Factory.DictionaryMappedItemFactory.Create(AutomationElement automationElement, ActionListener actionListener, Type customItemType) in c:\cruisecontrolrb\projects\white\work\Core\Factory\DictionaryMappedItemFactory.cs:line 22
at Core.Factory.PrimaryUIItemFactory.Create(SearchCriteria searchCriteria, ActionListener actionListener) in c:\cruisecontrolrb\projects\white\work\Core\Factory\PrimaryUIItemFactory.cs:line 100
at Core.UIItems.Container.NonCachedContainerItemFactory.Find(SearchCriteria searchCriteria) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\Container\NonCachedContainerItemFactory.cs:line 26
at Core.UIItems.Container.ContainerItemFactory.Get(SearchCriteria searchCriteria) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\Container\ContainerItemFactory.cs:line 14
at Core.Sessions.NullWindowSession.Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener) in c:\cruisecontrolrb\projects\white\work\Core\Sessions\NullWindowSession.cs:line 19
at Core.UIItems.Container.CurrentContainerItemFactory.Find(SearchCriteria searchCriteria, WindowSession windowSession) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\Container\CurrentContainerItemFactory.cs:line 40
at Core.UIItems.UIItemContainer.Get(SearchCriteria searchCriteria) in c:\cruisecontrolrb\projects\white\work\Core\UIItems\UIItemContainer.cs:line 81
---
Coordinator
Apr 12, 2008 at 4:47 PM
I think you need to use Tab instead of TabPage in your get call.
TabPages can be accessed from the Tab then.
Apr 15, 2008 at 11:35 AM


viveksingh wrote:
I think you need to use Tab instead of TabPage in your get call.
TabPages can be accessed from the Tab then.


I appreciate your suggestion and I have successfully able to get the tab as you suggest, but that doesnt explain why, in the above example, an exception is thrown.

The reason I was trying to get the tabpage directly was that in my application under test the tab has no uniquely identifiable properties to allow me to get it, whereas the tab pages do. As the structure Core.UIItems.TabItems.TabPage tabPage = WPFTestMainWindow.Get<Core.UIItems.TabItems.TabPage>(SearchCriteria.ByAutomationId("Autumn")); is allowed and makes sense (to me at least) I thought it would work and not throw the exception I've seen.

Thanks,

James.

Coordinator
Apr 15, 2008 at 2:23 PM
The way white has been designed you can get only PrimaryUIItems from window. TabPage is not primary item.
In your case may be you can use indexing if that works for you.
Apr 16, 2008 at 3:02 PM


viveksingh wrote:
The way white has been designed you can get only PrimaryUIItems from window. TabPage is not primary item.
In your case may be you can use indexing if that works for you.


I'll explore the indexing option you suggest,

Thanks,

James.