How to Select a File from JFileChooser

Ask general questions here.
Posts: 17
Joined: Mon Jan 16, 2012 10:25 am

How to Select a File from JFileChooser

Post by aunal » Mon Jan 16, 2012 1:46 pm


We have just started using Ranorex in our company and currently evaluating to determine whether it is a feasible option or not.

However, I have a problem regarding selecting files from JFileChooser. I can see the individual files with Ranorex Spy and highlight them, however while I'm recording, I observed that file names are trimmed in the Ranorex Repository and thus ranorex cannot access the individual files and uses the coordinates instead.

My configuration is as follows:

.Net RunTime Version: 2.0.50727.3625

Java: 1.6.0-b105

O/S: Windows XP with SP3

My first guess is; there is a character limit in the repository so ranorex cannot see the complete path to the component and uses the coordinates instead.

I added two screenshots, one taken from Ranorex Spy, showing the components (files in this case) and the other one is from Ranorex Repository, showing the trimmed path to the component.
Ranorex Spy shows the complete path to the file
RanorexSpy_JList_Items.JPG (167.38 KiB) Viewed 1523 times
Path to the file is trimmed in Ranorex Repository
RanorexRepository_JList_Items.JPG (197.49 KiB) Viewed 1523 times

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

Re: How to Select a File from JFileChooser

Post by Support Team » Mon Jan 16, 2012 6:15 pm

There is a setting in Ranorex (Settings -> General -> "Maximum length of text values in RanoreXPaths"; see attached screenshot) that limits the number of characters that are used for specific text attribute values. If the attribute value has more characters than that number, the value is converted to a regular expression.

For you list items you can either correct the RanoreXPath manually and paste the complete value of the "text" attribute in there; or you can change the above mentioned Ranorex setting to a higher value.

Ranorex Team
Settings.png (50.6 KiB) Viewed 1514 times