How to get a row from table (quicktable)

Ranorex Spy, Recorder, and Studio.
cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

How to get a row from table (quicktable)

Post by cwirek » Tue Sep 18, 2012 9:21 am

I have a problem with testing a .net application (Alior Trader 2 https://aliortrader.pl/install/Alior%20Trader%202.msi)
I want to get a value of control with type name QuickType (attachment image - Table)

In previously version of application I was using below code to get a value of rows in table:

Code: Select all

Form form = "/form[@title='Obserwowane instrumenty']/";
Table tab = form.FindSingle(".//table[@controltypename='AdvancedDataGridView']");
Now control type name is QuickType and when I'm trying to do use the same code:

Code: Select all

Form form = "/form[@title='Obserwowane instrumenty']/";
Table tab = form.FindSingle(".//element[@controltypename='QuickType']");
I have a error:

Code: Select all

Ranorex.CapabilityNotSupportedException: The element does not support the required capability 'table'. at Ranorex.Adapter..ctor(Element element) at Ranorex.Table.op_Implicit(Element element) 
Which type of variable I have to use, to get a row from table?
Attachments
instrument.png
table
instrument.png (50.22 KiB) Viewed 4200 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Tue Sep 18, 2012 4:01 pm

Hi,

You got this error because the element (QuickType) had changed and is now no longer of type table.
Which value do you want to get from this element or do you want to get the child elements?
Could you send/post a Ranorex snapshot file of your application?
This would help us to analyze the issue in detail.
Following link will show you how to generate a snapshot file:
Creating Ranorex Snapshot Files.

Regards,
Markus
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Wed Sep 19, 2012 6:58 am

Hi,

I want to get a value of cell from all rows in quicktable.
I attached a snapshot file
Attachments
at.rxsnp
(110.92 KiB) Downloaded 253 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Wed Sep 19, 2012 11:18 am

Hi,

Thanks for the snapshot, but it would be great if you could send us another snapshot of the child elements of the "QuickTable" element, this would help us to find a workaround for you.
If there are elements of type row you could search for all rows in that element:
IList<Row> rows = quickTable.FindDescendants<Row>();
            
            foreach(Row row in rows){
            	
            	foreach(Cell cell in row.Cells){
            		//some other code
            	}
            	
            }
Regards,
Markus
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Wed Sep 19, 2012 12:30 pm

Hi

I couldn't use code You paste, because Ranorex Spy recognize QuickTable as Element and this type of variable doesn't have a FindDescendants() method.

It looks like Ranorex Spy doesn't recognize any children of quicktable

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Thu Sep 20, 2012 8:28 am

Maybe I find workaround :D
I added to references of my project in Ranorex a library (Controls.dll) with controls from trader application.
I also added a using statement:

Code: Select all

using com.pfsoft.proftrading.controls.table.QuickTable;
But it's one problem I can't use a type QuickTable, in Visual Studio it's works.
What I'm doing wrong?
Attachments
visualStudio.png
visualStudio.png (56.01 KiB) Viewed 4170 times
ranorex.png
ranorex.png (79.63 KiB) Viewed 4170 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Thu Sep 20, 2012 3:40 pm

Hi,

Are you getting any error messages when you built your project?
This unfortunately wouldn't solve the issue as this has no influence on the ability of Ranorex to identify your elements.
What you can try is to add the specific "QuickTable" class to the GDI Capture List as described on the following link: [url=http://www.ranorex.com/blog/automation- ... i-capture-
plug-in]Automation of Legacy Applications with the GDI Capture Plug-In[/url].
Does this work in your case?

Regards,
Markus
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Fri Sep 21, 2012 7:11 am

Unfortunately it's doesn't work in my case.
Ranorex Spy doesn't recognize any Raw Text in control (image)
Is there any other method to recognize this control by Ranorex, ex. create plugin based on control library?
Attachments
spy.png
spy.png (27.38 KiB) Viewed 4160 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Fri Sep 21, 2012 3:53 pm

Hello,

Which version of the .NET Framework is installed on your machine? Maybe the .NET Framework 4.0 Full/Extended package is needed and not installed.
Are you able to track the elements with UISpy?

Regards,
Bernhard
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Tue Sep 25, 2012 7:21 am

List of installed .NET framework:
  • 3.5
    4 Client Profile
    4 Extended
Unfortunately I wasn't be able to track the elements with UISpy.
Any other ideas?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Tue Sep 25, 2012 2:55 pm

Hi,

Are you able to track the elements with Inspect or AccExplorer?
If not it seems that this is a custom control and that Ranorex is therefore not able to identify the elements in this table.
There are two ways how you can overcome this issue, you can add accessibility to enable Ranorex to identify those elements in the list as described in the following blog: Enabling automation for 3rd party controls by adding Accessibility, or you can use invoke remotely to call a method in order to get the elements of that table as described in the following blog and forum posts: Transferring data to and from a .NET control, link1, link2 and link3.
I hope this will help you solve the issue!

Regards,
Markus
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Thu Sep 27, 2012 3:52 pm

Hi

I want to use InvokeRemotely to get a data from control, like in this post http://www.ranorex.com/forum/janus-grid ... t3151.html, but I've a problem with loading assembly:

Code: Select all

Error loading code-completion information for Controls from C:\Users\test\Desktop\Controls.dll:
Error loading assembly:
System.BadImageFormatException: Invalid PE file
File name: 'C:\Users\test\Desktop\Controls.dll' ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Mono.Cecil.Metadata.MetadataStreamCollection.GetHeap(String name)
   at Mono.Cecil.Metadata.MetadataStreamCollection.get_GuidHeap()
   at Mono.Cecil.Metadata.MetadataReader.TerminateMetadataRoot(MetadataRoot root)
   at Mono.Cecil.Metadata.MetadataRoot.Accept(IMetadataVisitor visitor)
   at Mono.Cecil.Binary.ImageReader.VisitCLIHeader(CLIHeader header)
   at Mono.Cecil.Binary.CLIHeader.Accept(IBinaryVisitor visitor)
   at Mono.Cecil.Binary.Image.Accept(IBinaryVisitor visitor)
   at Mono.Cecil.Binary.ImageReader.Read(Image img, Stream stream)
   at Mono.Cecil.Binary.ImageReader.Read(String file)
   at Mono.Cecil.Binary.ImageReader.Read(String file)
   at ICSharpCode.SharpDevelop.Dom.CecilReader.LoadAssembly(String fileName, ProjectContentRegistry registry)
   at ICSharpCode.SharpDevelop.Dom.ProjectContentRegistry.LoadProjectContent(String itemInclude, String itemFileName)
   at ICSharpCode.SharpDevelop.Dom.ProjectContentRegistry.GetProjectContentForReference(String itemInclude, String itemFileName)
Error loading code-completion information for Controls from C:\Users\test\Desktop\Controls.dll:
Error loading assembly:
System.BadImageFormatException: Invalid PE file
File name: 'C:\Users\test\Desktop\Controls.dll' ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Mono.Cecil.Metadata.MetadataStreamCollection.GetHeap(String name)
   at Mono.Cecil.Metadata.MetadataStreamCollection.get_GuidHeap()
   at Mono.Cecil.Metadata.MetadataReader.TerminateMetadataRoot(MetadataRoot root)
   at Mono.Cecil.Metadata.MetadataRoot.Accept(IMetadataVisitor visitor)
   at Mono.Cecil.Binary.ImageReader.VisitCLIHeader(CLIHeader header)
   at Mono.Cecil.Binary.CLIHeader.Accept(IBinaryVisitor visitor)
   at Mono.Cecil.Binary.Image.Accept(IBinaryVisitor visitor)
   at Mono.Cecil.Binary.ImageReader.Read(Image img, Stream stream)
   at Mono.Cecil.Binary.ImageReader.Read(String file)
   at Mono.Cecil.Binary.ImageReader.Read(String file)
   at ICSharpCode.SharpDevelop.Dom.CecilReader.LoadAssembly(String fileName, ProjectContentRegistry registry)
   at ICSharpCode.SharpDevelop.Dom.ProjectContentRegistry.LoadProjectContent(String itemInclude, String itemFileName)
   at ICSharpCode.SharpDevelop.Dom.ProjectContentRegistry.GetProjectContentForReference(String itemInclude, String itemFileName)
I'm using Ranorex 3.2.3 and OS - Windows Server 2008 Standard or Windows 7 Professional 64-bit

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Fri Sep 28, 2012 10:36 am

Hi,

Could you check if you get the same error with the current Ranorex version (3.3.2)?
You will find the link to the download page on the start page of Ranorex Studio.

Regards,
Markus
Ranorex Support Team
.
Image

cwirek
Posts: 29
Joined: Mon Jul 02, 2012 4:24 pm

Re: How to get a row from table (quicktable)

Post by cwirek » Fri Sep 28, 2012 12:38 pm

I made a mistake, I'm using Ranorex 3.3.2

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to get a row from table (quicktable)

Post by Support Team » Mon Oct 01, 2012 4:06 pm

Hello,

Do you use the correct bit version of the dll? It seems that you use a 64bit dll for a 32bit project.

Regards,
Bernhard
Ranorex Support Team
.
Image