OpenKeyWord  Version: 426, Datum:
SeLink.cs
1 #region Header
2 /*
3  ==============================================================================
4  Author: Zoltan Hrabovszki <zh@openkeyword.de>
5 
6  Copyright © 2012, 2013, 2014, 2015 IT-Beratung Hrabovszki
7  www.OpenKeyWord.de
8  ==============================================================================
9 
10  This file is part of OpenKeyWord.
11 
12  OpenKeyWord is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  OpenKeyWord is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with OpenKeyWord. If not, see <http://www.gnu.org/licenses/>.
24 
25  Diese Datei ist Teil von OpenKeyWord.
26 
27  OpenKeyWord ist Freie Software: Sie können es unter den Bedingungen
28  der GNU General Public License, wie von der Free Software Foundation,
29  Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
30  veröffentlichten Version, weiterverbreiten und/oder modifizieren.
31 
32  OpenKeyWord wird in der Hoffnung, dass es nützlich sein wird, aber
33  OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
34  Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
35  Siehe die GNU General Public License für weitere Details.
36 
37  Sie sollten eine Kopie der GNU General Public License zusammen mit
38  OpenKeyWord erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
39 */
40 #endregion Header
41 
42 namespace OKW.GUI.Selenium
43 {
44  using System;
45  using System.Collections.Generic;
46 
47  using OKW.GUI;
48  using OKW.Log;
49 
50  using OpenQA.Selenium;
51 
55  public class SeLink : SeAnyWin // , IOKW_Clickable
56  {
57  #region Constructors
58 
59  public SeLink(string Locator, params OKWLocator[] fpLocators)
60  : base(Locator, fpLocators)
61  {
62  }
63 
64  #endregion Constructors
65 
66  #region Methods
67  public override void ClickOn()
76  {
77  try
78  {
79  this.LogFunctionStartDebug("ClickOn");
80 
81  // Wenn das Objekt nicht existiert mit Exception beenden...
82  if (!this.GetExists())
83  {
84  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "SeAnyWin.TypeKey()");
85  throw new OKWGUIObjectNotFoundException(lvsLM);
86  }
87 
88  this.Me().Click();
89  }
90  finally
91  {
92  this.LogFunctionEndDebug();
93  }
94 
95  return;
96  }
97 
98  public virtual List<string> GetValue_CONTENT()
99  {
100  throw new NotImplementedException();
101  }
102 
103  public List<string> GetValue_CONTENT(List<string> fpExpected)
104  {
105  // TODO GetValue_CONTENT aus IOKW_Clickable entfernen? Prüfen
106  throw new NotImplementedException();
107  }
108 
121  public override bool GetIsActive()
122  {
123  throw new NotImplementedException("Link cannot be Active");
124  }
125 
126  public override bool LogIsActive()
127  {
128  throw new NotImplementedException("Link cannot be Active");
129  }
130 
131  public override bool MemorizeIsActive()
132  {
133  throw new NotImplementedException("Link cannot be Active");
134  }
135 
136  public virtual bool VerifyIsActive()
137  {
138  throw new NotImplementedException("Link cannot be Active");
139  }
140 
145  public override List<string> GetValue()
146  {
147 
148  List<string> lvLsReturn = new List<string>();
149  bool bOK = false;
150  try
151  {
152  MyLogger.LogFunctionStartDebug("GetCaption");
153 
154  // Wenn das Objekt nicht existiert mit Exception beenden...
155  if (!this.GetExists())
156  {
157  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "GetCaption()");
158  throw new OKWGUIObjectNotFoundException(lvsLM);
159  }
160 
161  // The Attribute "value" wird als Beschriftung angezeigt...
162  lvLsReturn.Add(this.Me().GetAttribute("href"));
163  bOK = true;
164  }
165  finally
166  {
167  if (bOK)
168  {
169  MyLogger.LogFunctionEndDebug(lvLsReturn);
170  }
171  else
172  {
173  MyLogger.LogFunctionEndDebug();
174  }
175  }
176 
177  return lvLsReturn;
178  }
179 
190  public override List<string> LogValue()
191  {
192  bool bOK = false;
193  List<string> lvLsReturn = new List<string>();
194 
195  try
196  {
197  MyLogger.LogFunctionStartDebug("LogValue");
198  lvLsReturn = this.GetValue();
199  bOK = true;
200  }
201  finally
202  {
203  if (bOK)
204  {
205  MyLogger.LogFunctionEndDebug(lvLsReturn);
206  }
207  else
208  {
209  MyLogger.LogFunctionEndDebug();
210  }
211  }
212 
213  return lvLsReturn;
214  }
215 
230  public override List<string> MemorizeValue()
231  {
232  List<string> lvLsReturn = new List<string>();
233  bool bOK = false;
234 
235  try
236  {
237  MyLogger.LogFunctionStartDebug("Memorize");
238  lvLsReturn = this.GetValue();
239  bOK = true;
240  }
241  finally
242  {
243  if (bOK)
244  {
245  MyLogger.LogFunctionEndDebug(lvLsReturn);
246  }
247  else
248  {
249  MyLogger.LogFunctionEndDebug();
250  }
251  }
252 
253  return lvLsReturn;
254  }
255 
267  public override List<string> VerifyValue(List<string> fplsExpectedValue)
268  {
269  List<string> lvLsReturn = new List<string>();
270  bool bOK = false;
271 
272  try
273  {
274  MyLogger.LogFunctionStartDebug("Memorize", "fplsExpectedValue", fplsExpectedValue[0]);
275 
276  // GetValue als delegaten definieren
277  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetValue;
278 
279  // Nun mit dem erwarteten Sollwert und GetValue ggf. auf den Wert Warten.
280  lvLsReturn = MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
281 
282  bOK = true;
283  }
284  finally
285  {
286  if (bOK)
287  {
288  MyLogger.LogFunctionEndDebug(lvLsReturn);
289  }
290  else
291  {
292  MyLogger.LogFunctionEndDebug();
293  }
294  }
295 
296  return lvLsReturn;
297  }
298 
299 
300  #endregion Methods
301  }
302 }
delegate List< string > ListStringCallBack()
Callback Muster string Variante.
Diese Ausnahme wird ausgelöst, wenn ein GUI-Objekt zu den im Frame gegebenen Objekterkennungseigensch...
OKW_Wait4Value ist die zetrale Klasse, die für das Warten auf GUI eigenschaften zuständig ist...
Description of OKWLocator.
Definition: OKWLocator.cs:52
Definition: Core.cs:40