OpenKeyWord  Version: 426, Datum:
afTree.cs
1 #region Header
2 
3 /*
4  * Created by SharpDevelop.
5  * User: Zoltan
6  * Date: 01.05.2013
7  * Time: 17:55
8  *
9  * To change this template use Tools | Options | Coding | Edit Standard Headers.
10  */
11 
12 #endregion Header
13 
14 namespace OKW.GUI.Selenium.ADF
15 {
16  using System;
17  using System.Collections.Generic;
18 
19  using OKW.GUI;
20  using OKW.GUI.Selenium;
21  using OKW.Log;
22 
23  using OpenQA.Selenium;
24 
68  public class afTree : SeAnyWin // , IOKW_ListDataObj
69  {
70  #region Constructors
71 
78  public afTree(string Locator)
79  : base(Locator)
80  {
81  }
82 
83  #endregion Constructors
84 
85  #region Methods
86 
94  public virtual IWebElement FindNode(string fpsXPATH2Node)
95  {
96  this.LogFunctionStartDebug("FindNode", "String fpsXPATH2Node", fpsXPATH2Node);
97 
98  // DomTreeRoot Zeigt auf das DomElement welches das Gesammte afTree beinhaltet!
99  IWebElement lvDomTreeRoot = Me();
100 
101  IWebElement lvElementLabel = lvDomTreeRoot;
102  IWebElement lvElementGuard;
103 
104  IWebElement lvReturnElement = null;
105 
106  lvDomTreeRoot.Highlight();
107 
108  // Splitten des Wertes
109  List<string> lvls_Nodes;
110  string lvs_PathSep = OKW_Ini.Instance.OKW_CustomSettings.PathSep;
111  lvls_Nodes = OKW_Helper.StrSplit(fpsXPATH2Node, lvs_PathSep);
112 
113  for (int lvi_i = 0; lvi_i < lvls_Nodes.Count; lvi_i++)
114  {
115  // Der Knoten kann //SPAN oder //A sein <span class="xsn" _afrndtxt="1">My Files</span>
116  Logger.Instance.LogPrint("Knoten: " + lvls_Nodes[lvi_i]);
117  lvElementLabel = lvElementLabel.FindElement(By.XPath("//*[text()='" + lvls_Nodes[lvi_i] + "']"));
118  lvElementGuard = lvElementLabel;
119  lvElementGuard.Highlight();
120 
121  // Baum hoch traversieren bis Class-Attribut mit Wert singelline vorkommt...
122  bool bLoop = true;
123 
124  while (bLoop)
125  {
126  // class="xso"
127  if (lvElementGuard.GetAttribute("class") == "xso")
128  {
129  bLoop = false;
130  }
131  else
132  {
133  lvElementGuard = lvElementGuard.FindElement(By.XPath(".."));
134  }
135  }
136 
137  if (lvi_i == lvls_Nodes.Count - 1)
138  {
139  // Haben wir das Ende/Blatt erreicht? Link auf textContents -> letzes Blatt auswählen!
140  lvReturnElement = lvElementLabel;
141  }
142  else
143  {
144  // Sonst den Ast aufklappen, aber nur wenn er noch nicht auf geklappt ist.
145  try
146  {
147  lvElementGuard.Highlight();
148  IWebElement ElementIMG = lvElementGuard.FindElement(By.XPath(".//a")); // Baum aufklappen
149  ElementIMG.Highlight();
150 
151  if (OKW_Helper.MatchStr("Einblenden", ElementIMG.GetAttribute("title")))
152  {
153  ElementIMG.Highlight();
154  ElementIMG.Click();
155 
156  System.Threading.Thread.Sleep(2000);
157  }
158  }
159  finally
160  {
161  Logger.Instance.LogPrint("Knoten " + lvls_Nodes[lvi_i] + "nicht aufklappbar");
162  this.LogFunctionEndDebug();
163  }
164  }
165  }
166 
167  // TODO: bOK für return in finally einabuen
168  this.LogFunctionEndDebug(lvReturnElement.ToString());
169  return lvReturnElement;
170  }
171 
179  public virtual void Select(List<string> fpsValues)
180  {
181  IWebElement ElementNode;
182 
183  for (int i = 0; i < fpsValues.Count; i++)
184  {
185  ElementNode = this.FindNode(fpsValues[i]);
186  ElementNode.Click();
187  }
188 
189  return;
190  }
191 
192  public void Click_On(string Click_Type)
193  {
194  throw new NotImplementedException();
195  }
196 
197  public void Select(System.Collections.Generic.List<string> Values, string Click_Type)
198  {
199  throw new NotImplementedException();
200  }
201 
202  #endregion Methods
203  }
204 }
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
Definition: Logger.cs:302
virtual IWebElement FindNode(string fpsXPATH2Node)
Ermittelt den das Dom Element welches den gegebene Pfad ermittel.
Definition: afTree.cs:94
Klasse enthält OKW-Hilfsfunktionen.
Definition: OKW_Helper.cs:63
static OKW_Ini Instance
Singelton-Pattern: Instanz gibt die aktuelle, gültige und einzige Innstanz der Klasse zurück...
Definition: OKW_Ini.cs:306
virtual void Select(List< string > fpsValues)
Wählt den als Parameter gegebene Knoten im Baum aus: In der standard Implementierung wird ein Klick a...
Definition: afTree.cs:179
afTree(string Locator)
Konstruktor.
Definition: afTree.cs:78
string PathSep
Öffentliches Property "PathSep".
OKW.OKW_Ini ist die Klasse zur Konfigurationsdatei OKW_Ini.xml.
Definition: OKW_Ini.cs:188
Die Klasse OKW.GUI.Selenium.ADF.afTree ist eine OKW-Automatisierungsklasse für ein Oracle-ADF Tree-Ob...
Definition: afTree.cs:68
OKW_CustomSettings OKW_CustomSettings
Dieses Feld hält den Abschnitt OKW_CustomSettings der OKW_Ini.xml vor.
Definition: OKW_Ini.cs:204
static List< string > StrSplit(string fpsString2Split, string fpsSeparator)
Splittet einen string am angegebenen Separator auf. Der Separator kann aus mehr als einem Zeichen bes...
Definition: OKW_Helper.cs:737
static bool MatchStr(string fpsPattern, string fpsStringToMatch)
Quelle: http://stackoverflow.com/questions/6907720/need-to-perform-wildcard-etc-search-on-a-string-us...
Definition: OKW_Helper.cs:491
Definition: Core.cs:40