Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 27, 2012
@nagappan nagappan Ignore special characters while searching object name
Ignore special characters while searching object name
Add $ at end of search

QA Notes:
Testing Done:
Documentation Notes:
Bug Number:
Reviewed by:
Approved by:
Mailto:
5c0f70b
@nagappan nagappan Updated project name e8a73e2
Showing with 26 additions and 10 deletions.
  1. +1 −1 CobraWinLDTP/README.txt
  2. +24 −8 Ldtpd/Utils.cs
  3. +1 −1 README.txt
View
2 CobraWinLDTP/README.txt
@@ -1,4 +1,4 @@
-Cobra WinLDTP is based on Linux Desktop Testing Project - http://ldtp.freedesktop.org
+Cobra - Windows version of Linux Desktop Testing Project - http://ldtp.freedesktop.org
Verified with Windows XP SP3 / Windows 7 SP1
View
32 Ldtpd/Utils.cs
@@ -136,7 +136,7 @@ internal void InternalLaunchApp(object data)
// Trying to mimic python fnmatch.translate
String tmp = Regex.Replace(windowName, @"\*", @".*");
tmp = Regex.Replace(tmp, @"\\", @"\\");
- tmp = Regex.Replace(tmp, " ", "");
+ tmp = Regex.Replace(tmp, "( |\r|\n)", "");
//tmp += @"\Z(?ms)";
Regex rx = new Regex(tmp, RegexOptions.Compiled |
RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline |
@@ -152,7 +152,7 @@ internal void InternalLaunchApp(object data)
currObjInfo = objInfo.GetObjectType(e);
s = e.Current.Name;
if (s != null)
- s = (new Regex(" ")).Replace(s, "");
+ s = Regex.Replace(s, "( |\r|\n)", "");
if (s == null || s.Length == 0)
{
// txt0, txt1
@@ -257,7 +257,7 @@ internal void InternalLaunchApp(object data)
currObjInfo = objInfo.GetObjectType(element);
s = element.Current.Name;
if (s != null)
- s = (new Regex(" ")).Replace(s, "");
+ s = Regex.Replace(s, "( |\r|\n)", "");
if (s == null || s == "")
{
// txt0, txt1
@@ -326,7 +326,7 @@ internal void InternalLaunchApp(object data)
currObjInfo = objInfo.GetObjectType(subChild);
s = subChild.Current.Name;
if (s != null)
- s = (new Regex(" ")).Replace(s, "");
+ s = Regex.Replace(s, "( |\r|\n)", "");
if (s == null || s == "")
{
// txt0, txt1
@@ -539,8 +539,8 @@ internal AutomationElement GetObjectHandle(AutomationElement e, String objName)
InternalTreeWalker w = new InternalTreeWalker();
// Trying to mimic python fnmatch.translate
- String tmp = Regex.Replace(objName, @"\*", @".*");
- tmp = Regex.Replace(tmp, " ", "");
+ String tmp = Regex.Replace(objName, @"\*", @".*") + "$";
+ tmp = Regex.Replace(tmp, @"( |:|\.|_|\r|\n)", "");
tmp = Regex.Replace(tmp, @"\\", @"\\");
tmp = Regex.Replace(tmp, @"\(", @"\(");
tmp = Regex.Replace(tmp, @"\)", @"\)");
@@ -566,11 +566,26 @@ internal AutomationElement GetObjectHandle(AutomationElement e, String objName)
if (debug)
LogMessage("Obj name: " + s + " : " +
element.Current.ControlType.ProgrammaticName);
+ if (element.Current.ControlType == ControlType.MenuItem)
+ { // Do this only for menuitem type
+ // Split keyboard shortcut, as that might not be
+ // part of user provided object name
+ // Pattern anything has Ctrl+ || Function key
+ string[] tmpStrArray = Regex.Split(s,
+ @"(Ctrl\+|F\d)");
+ LogMessage("Menuitem shortcut length: " +
+ tmpStrArray.Length);
+ if (tmpStrArray.Length > 1)
+ // Keyboard shortcut found,
+ // just take first element from array
+ s = tmpStrArray[0];
+ tmpStrArray = null;
+ }
}
if (currObjInfo.objType != null)
{
if (s != null)
- s = (new Regex(" ")).Replace(s, "");
+ s = Regex.Replace(s, @"( |\t|:|\.|_|\r|\n)", "");
if (s == null || s.Length == 0)
{
// txt0, txt1
@@ -581,6 +596,7 @@ internal AutomationElement GetObjectHandle(AutomationElement e, String objName)
{
// txtName, txtPassword
actualString = currObjInfo.objType + s;
+ LogMessage("###" + actualString + "###");
index = 1;
while (true)
{
@@ -701,7 +717,7 @@ internal AutomationElement GetObjectHandle(AutomationElement e, String objName)
}
actualString = null;
if (s != null)
- s = (new Regex(" ")).Replace(s, "");
+ s = Regex.Replace(s, " ", "");
if (s == null || s.Length == 0)
{
// txt0, txt1
View
2 README.txt
@@ -1,4 +1,4 @@
-Windows version of Linux Desktop Testing Project (WinLDTP) - http://ldtp.freedesktop.org
+Cobra - Windows version of Linux Desktop Testing Project (WinLDTP) - http://ldtp.freedesktop.org
LDTP is a GUI test automation tool works on both Windows and Linux platform
Verified with Windows XP SP3 / Windows 7 SP1

No commit comments for this range

Something went wrong with that request. Please try again.