OpenKeyWord  Version: 426, Datum:
afTreeTable.cs
1 #region Header
2 
3 /*
4  * Created by SharpDevelop.
5  * User: Zoltan
6  * Date: 23.10.2013
7  * Time: 07: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 
29  public class afTreeTable : SeAnyWin
30  {
31  #region Constructors
32 
33  public afTreeTable(string Locator)
34  : base(Locator)
35  {
36  }
37 
38  #endregion Constructors
39 
40  #region Methods
41 
42  public virtual IWebElement FindNode(string fpsXPATH2Node)
43  {
44  this.LogFunctionStartDebug("FindNode", "String fpsXPATH2Node", fpsXPATH2Node);
45 
46  // DomTreeRoot Zeigt auf das DomElement welches das Gesammte afTree beinhaltet!
47  IWebElement DomTreeRoot = Me();
48 
49  IWebElement ElementLabel = DomTreeRoot;
50  IWebElement ElementGuard;
51 
52  IWebElement lv_ReturnElement = null;
53 
54  DomTreeRoot.Highlight();
55 
56  // Splitten des Wertes
57  List<string> lvls_Nodes;
58  string lvs_PathSep = OKW_Ini.Instance.OKW_CustomSettings.PathSep;
59  lvls_Nodes = OKW_Helper.StrSplit(fpsXPATH2Node, lvs_PathSep);
60 
61  for (int lvi_i = 0; lvi_i < lvls_Nodes.Count; lvi_i++)
62  {
63  // Knoten kann //SPAN oder //A sein <span class="xsn" _afrndtxt="1">My Files</span>
64  Logger.Instance.LogPrint("Knoten: " + lvls_Nodes[lvi_i]);
65  ElementLabel = ElementLabel.FindElement(By.XPath("//*[text()='" + lvls_Nodes[lvi_i] + "']"));
66  ElementGuard = ElementLabel;
67  ElementGuard.Highlight();
68 
69  // Baum hoch traversieren bis Class-Attribut mit Wert singelline vorkommt...
70  bool bLoop = true;
71 
72  while (bLoop)
73  {
74  // class="xso"
75  if (ElementGuard.GetAttribute("class") == "xso")
76  {
77  bLoop = false;
78  }
79  else
80  {
81  ElementGuard = ElementGuard.FindElement(By.XPath(".."));
82  }
83  }
84 
85  // Haben wir das Ende/Blatt erreicht?
86  if (lvi_i == lvls_Nodes.Count - 1)
87  {
88  // Link auf textContents -> letzes Blatt auswählen!
89  lv_ReturnElement = ElementLabel;
90  }
91  else
92  {
93  // Sonst den Ast auf klappen aber nur wenn noch nicht auf geklappt ist.
94  try
95  {
96  ElementGuard.Highlight();
97  IWebElement ElementIMG = ElementGuard.FindElement(By.XPath(".//a")); // Baum aufklappen
98  ElementIMG.Highlight();
99 
100  if (OKW_Helper.MatchStr("Einblenden", ElementIMG.GetAttribute("title")))
101  {
102  ElementIMG.Highlight();
103  ElementIMG.Click();
104 
105  System.Threading.Thread.Sleep(2000);
106  }
107  }
108  finally
109  {
110  Logger.Instance.LogPrint("Knoten " + lvls_Nodes[lvi_i] + "nicht aufklappbar");
111  }
112  }
113  }
114 
115  this.LogFunctionEndDebug(lv_ReturnElement.ToString());
116  return lv_ReturnElement;
117  }
118 
119  public virtual void Select(List<string> fpsValues)
120  {
121  IWebElement ElementNode;
122 
123  for (int i = 0; i < fpsValues.Count; i++)
124  {
125  ElementNode = this.FindNode(fpsValues[i]);
126  ElementNode.Click();
127  }
128 
129  return;
130  }
131 
132  public void Click_On(string Click_Type)
133  {
134  throw new NotImplementedException();
135  }
136 
137  public void Select(System.Collections.Generic.List<string> Values, string Click_Type)
138  {
139  throw new NotImplementedException();
140  }
141 
142  #endregion Methods
143  }
144 }
void LogPrint(string fps_Message)
LogPrint Function: Prints the values of expressions to the results file.
Definition: Logger.cs:302
Klasse enthält OKW-Hilfsfunktionen.
Definition: OKW_Helper.cs:63
Description of afTree.
Definition: afTreeTable.cs:29
static OKW_Ini Instance
Singelton-Pattern: Instanz gibt die aktuelle, gültige und einzige Innstanz der Klasse zurück...
Definition: OKW_Ini.cs:306
string PathSep
Öffentliches Property "PathSep".
OKW.OKW_Ini ist die Klasse zur Konfigurationsdatei OKW_Ini.xml.
Definition: OKW_Ini.cs:188
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