Class library usage, coding and language questions.
-
anas
- Posts: 5
- Joined: Sun May 12, 2013 6:25 pm
Post
by anas » Sun May 12, 2013 6:45 pm
Hello
just wonder why the same function returns different values depending on where in the code it is used
Code: Select all
Form MainWindowForm = Host.Local.GetApplicationForm(MyProcess, 120000);
...
String path=MainWindowForm.GetPath().ToString();
....
String path1=MainWindowForm.GetPath().ToString();
in first case it returns
"/form[@title='MyApplication Test v1.2.3.4']"
and when it is used several lines below it returns
"/form[@title~'^'MyApplication\ Test \ v1\.2\.3\.4\ -\ ']"
thanks,
anas
-
Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
-
Contact:
Post
by Support Team » Tue May 14, 2013 8:53 am
If you look carefully, you will see that the two titles of the application are not the same: The second title has the string " - " at the end.
By default, if a title exceeds 25 characters, Ranorex creates a RanoreXPath that searches for the first 25 characters using a regular expression (RegEx). Because of the additional chars in the second title, this 25 chars limit is exceeded and the RegEx is used.
Regards,
Alex
Ranorex Team
-
anas
- Posts: 5
- Joined: Sun May 12, 2013 6:25 pm
Post
by anas » Tue May 14, 2013 5:14 pm
thanks Alex
I am not exactly sure what do you mean
it is the same application within the same program
why it returns different values - what changes between this function called first time and a few lines below?
thanks,
anas
-
Ciege
- Posts: 1336
- Joined: Thu Oct 16, 2008 6:46 pm
- Location: Arizona, USA
Post
by Ciege » Tue May 14, 2013 6:53 pm
Can you post a Ranorex snapshot file of your form at points when the path is one way, then the other?
Is the Title of your form actually changing when you are doing your steps indicated by "..."?
What steps are you doing in the "..." section?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
-
anas
- Posts: 5
- Joined: Sun May 12, 2013 6:25 pm
Post
by anas » Thu May 16, 2013 7:03 pm
hi Ciege
thanks for your help
I checked and it was my mistake
indeed in between there were windows opened and additional information was added to the title
thats why as was noted by you before "- ..." was added
thanks,
anas