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