Field validation error when using program.cs

Ranorex Studio, Spy, Recorder, and Driver.
tsyingling
Posts: 20
Joined: Wed Nov 04, 2009 5:18 pm

Field validation error when using program.cs

Post by tsyingling » Tue Nov 10, 2009 6:58 pm

Had this happen only twice now on two different fields (out of hundreds) but no idea what it means. I'm not a programmer by trade so this may be something simple? When I run the following generated code as part of the recording (play file) it works fine.

Validating AttributeEqual condition (Text='( ) - ') on item 'TextNumber (WebDocumentRhapsody)'.");
Validate.Attribute(repo.WebDocumentRhapsody.TabPageListTabControl2.TextNumber, "Text", "( ) - ");
Delay.Milliseconds(100);

However when this part of the code runs as part of the compiled exe for the project, I get the following error:

Attribute 'Text' of element '{Text:Number}' does not match the specified value (actual='( ) - ', expected='( ) - ').
2009/11/10 12:40:25.135 ERROR User Ranorex.ValidationException: Attribute 'Text' of element '{Text:Number}' does not match the specified value (actual='( ) - ', expected='( ) - '). at Ranorex.Validate.IsTrue(Boolean condition, String message, Boolean exceptionOnFail) at Ranorex.Validate.Attribute(Element element, String name, Object value, String message, Boolean exceptionOnFail) at Ranorex.Validate.Attribute(Element element, String name, Object value) at PhysicianPNTab.PPNAdd.Start() in c:\Documents and Settings\yingti00\My Documents\RanorexStudio Projects\PhysicianPNTab\PhysicianPNTab\PPNAdd.cs:line 62 at PhysicianPNTab.Program.Main(String[] args) in c:\Documents and Settings\yingti00\My Documents\RanorexStudio Projects\PhysicianPNTab\PhysicianPNTab\Program.cs:line 39

As I said, I've only had this twice on two different fields in two different projects and the other field seemed like just a simple text field. Haven't had this anywhere else yet. Can I correct for this using the app tools for Studio?

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

Re: Field validation error when using program.cs

Post by Support Team » Wed Nov 11, 2009 5:20 pm

What's the version of Ranorex you are using?
What kind of application is it you try to automate (.NET WinForms, WPF, Silverlight, Web, ...)?
Could you attach a Ranorex snapshot of the TabPageListTabControl2 element to your post (see http://www.ranorex.com/support/user-gui ... html#c2072)?

Regards,
Alex
Ranorex Support Team

tsyingling
Posts: 20
Joined: Wed Nov 04, 2009 5:18 pm

Re: Field validation error when using program.cs

Post by tsyingling » Thu Nov 12, 2009 6:16 pm

The version of Ranorex Studio is 2.1.2.6480.
The application is a Silverlight application.
When I used Ranorex Spy to capture the screen, it captured the tab as "TabPage 'TabItem'". Captured all 5 tabs as "TabPage 'TabItem'". I tried to follow the instructions in the user guide link but I'm not even sure I have a <SCROLL> shortcut so I hope I got what you needed. I noticed in the repository that was created with the recorder that the same tab was captured as 4 different increments (TabPageListTabControl, TabPageListTabControl1, etc.) even though it was the same tab all 4 times. I've attached the repository from the recording as well. Hope this makes sense. Not sure it does to me.
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: Field validation error when using program.cs

Post by Support Team » Wed Nov 18, 2009 6:34 pm

We identified this to be a bug of the code generation in Ranorex Studio. Ranorex Studio has a setting to convert tabs to spaces and vice versa. This setting caused tabs and spaces in string values to be converted, too; so the 4 spaces in your validation string are converted to a tab and consequently do not match the actual value of the element.

This bug will be fixed in the next Ranorex service release V2.2.1.
Meanwhile, as a workaround please check the "Convert Tabs to Spaces" checkbox in the Ranorex Studio "Tools -> Options -> Text Editor -> Behavior" tab page.

Regards,
Alex
Ranorex Support Team