OpenKeyWord  Version: 426, Datum:
SeAnyWin.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  using System.Collections.ObjectModel;
47 
48  using System.Threading;
49 
50  using OKW.GUI;
51  using OKW.Log;
52 
53  using OpenQA.Selenium;
54  using OpenQA.Selenium.Internal;
55 
64  public static class WebElementExtender
65  {
66  #region Methods
67 
68  public static void Highlight(this IWebElement element)
69  {
70  const int WAIT = 1;
71 
72  string orig = element.GetAttribute("style");
73  SetAttribute(element, "style", "color: yellow; border: 1px solid yellow; background-color: black;");
74  Thread.Sleep(WAIT);
75  SetAttribute(element, "style", "color: black; border: 1px solid black; background-color: yellow;");
76  Thread.Sleep(WAIT);
77  // SetAttribute(element, "style", "color: yellow; border: 1px solid yellow; background-color: black;");
78  // Thread.Sleep(WAIT);
79  // SetAttribute(element, "style", "color: black; border: 1px solid black; background-color: yellow;");
80  // Thread.Sleep(WAIT);
81  SetAttribute(element, "style", orig);
82  }
83 
84  public static void SetAttribute(this IWebElement element, string attributeName, string value)
85  {
86  IWrapsDriver wrappedElement = element as IWrapsDriver;
87  if (wrappedElement == null)
88  {
89  throw new ArgumentException("element", "Element must wrap a web driver");
90  }
91 
92  IWebDriver driver = wrappedElement.WrappedDriver;
93  IJavaScriptExecutor javascript = driver as IJavaScriptExecutor;
94  if (javascript == null)
95  {
96  throw new ArgumentException("element", "Element must wrap a web driver that supports javascript execution");
97  }
98  try
99  {
100  javascript.ExecuteScript("arguments[0].setAttribute(arguments[1], arguments[2])", element, attributeName, value);
101  }
102  catch( Exception e)
103  {
104  System.Console.WriteLine("============================================");
105  System.Console.WriteLine(e.Message);
106  System.Console.WriteLine("============================================");
107  }
108  }
109  #endregion Methods
110 
111  }
119  public class SeAnyWin : AnyWinBase
120  {
121  #region Fields
122 
123  // Logger Instance holen
124  protected Log.Logger MyLogger = Log.Logger.Instance;
125  protected OKW_Wait4Value MyWait4Value = new OKW_Wait4Value();
126 
127  protected LogMessenger LM = new LogMessenger("GUI");
128 
129  #endregion Fields
130 
131  #region Constructors
132 
133  public SeAnyWin(string Locator, params OKWLocator[] fpLocators)
134  : base(Locator, fpLocators)
135  {
136  }
137 
138  #endregion Constructors
139 
140  #region Methods
141 
150  public virtual void ClickOn()
151  {
152  try
153  {
154  this.LogFunctionStartDebug("ClickOn");
155 
156  // Wenn das Objekt nicht existiert mit Exception beenden...
157  if (!this.GetExists())
158  {
159  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "SeAnyWin.TypeKey()");
160  throw new OKWGUIObjectNotFoundException(lvsLM);
161  }
162 
163  this.Me().Click();
164  }
165  finally
166  {
167  this.LogFunctionEndDebug();
168  }
169 
170  return;
171  }
172 
181  public virtual bool GetExists()
182  {
183  this.MyLogger.LogFunctionStartDebug("Exists");
184  bool lvbReturn = false;
185  bool bOK = false;
186 
187  try
188  {
189  this.Me();
190  lvbReturn = true;
191  bOK = true;
192  }
194  {
195  this.MyLogger.LogPrintDebug("NoSuchElementException");
196  lvbReturn = false;
197  bOK = true;
198  }
199  finally
200  {
201  if (bOK)
202  {
203  this.MyLogger.LogFunctionEndDebug(lvbReturn);
204  }
205  else
206  {
207  this.MyLogger.LogFunctionEndDebug();
208  }
209  }
210 
211  return lvbReturn;
212  }
213 
222  public virtual bool GetIsActive()
223  {
224  bool lvbReturn = false;
225  bool bOK = false;
226  var lvDisabled = string.Empty;
227 
228  try
229  {
230  this.MyLogger.LogFunctionStartDebug("GetIsActive");
231 
232  // Wenn das Objekt nicht existiert mit Exception beenden...
233  if (!this.GetExists())
234  {
235  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "SeAnyWin.TypeKey()");
236  throw new OKWGUIObjectNotFoundException(lvsLM);
237  }
238 
239  lvDisabled = this.Me().GetAttribute("disabled");
240 
241  if (lvDisabled == null || lvDisabled != "true")
242  {
243  lvbReturn = true;
244  }
245  else
246  {
247  lvbReturn = false;
248  }
249 
250  bOK = true;
251  }
252  finally
253  {
254  if (bOK)
255  {
256  this.MyLogger.LogFunctionEndDebug(lvbReturn);
257  }
258  else
259  {
260  this.MyLogger.LogFunctionEndDebug();
261  }
262  }
263 
264  return lvbReturn;
265  }
266 
281  public virtual bool LogExists()
282  {
283  bool lvbReturn = false;
284  bool bOK = false;
285 
286  try
287  {
288  this.MyLogger.LogFunctionStartDebug("LogExists");
289 
290  lvbReturn = this.GetExists();
291 
292  bOK = true;
293  }
294  finally
295  {
296  if (bOK)
297  {
298  this.MyLogger.LogFunctionEndDebug(lvbReturn);
299  }
300  else
301  {
302  this.MyLogger.LogFunctionEndDebug();
303  }
304  }
305 
306  return lvbReturn;
307  }
308 
323  public virtual bool LogIsActive()
324  {
325  bool lvbReturn = false;
326  bool bOK = false;
327 
328  try
329  {
330  this.MyLogger.LogFunctionStartDebug("LogIsActive");
331 
332  lvbReturn = this.GetIsActive();
333 
334  bOK = true;
335  }
336  finally
337  {
338  if (bOK)
339  {
340  this.MyLogger.LogFunctionEndDebug(lvbReturn);
341  }
342  else
343  {
344  this.MyLogger.LogFunctionEndDebug();
345  }
346  }
347 
348  return lvbReturn;
349  }
350 
359  public virtual IWebElement Me()
360  {
361  this.MyLogger.LogFunctionStartDebug("Me");
362  IWebElement me = null;
363 
364  ReadOnlyCollection<IWebElement> meme;
366 
367  try
368  {
369  //me = SeDriver.Instance.driver.FindElement(By.XPath(this.Locator));
370  meme = SeDriver.Instance.driver.FindElements(By.XPath(this.Locator));
371 
372  if (meme.Count == 0)
373  {
374  string lvsPrintMe = "GUI-Objekt wurde nicht gefunden: Locator: >>" + this.Locator + "<<";
375 
376  this.MyLogger.LogPrint( "????????????????????????????????????????????????????????????" );
377  this.MyLogger.LogPrint( lvsPrintMe );
378  this.MyLogger.LogPrint( "????????????????????????????????????????????????????????????" );
379 
380  throw new OKWGUIObjectNotFoundException( lvsPrintMe );
381  }
382  else if (meme.Count > 1)
383  {
384  string lvsPrintMe = "Locator ist nicht eindeutig, es wurden mehrer GUI-Objekt gefunden:\n Locator: >>" + this.Locator + "<<";
385 
386  this.MyLogger.LogPrint( "????????????????????????????????????????????????????????????" );
387  this.MyLogger.LogPrint( lvsPrintMe );
388  this.MyLogger.LogPrint( "????????????????????????????????????????????????????????????" );
389 
390  throw new OKWGUIObjectNotFoundException( lvsPrintMe );
391  }
392  else
393  {
394  me = meme[0];
395  }
396  }
397  finally
398  {
399  if (me != null)
400  {
401  me.Highlight();
402  this.MyLogger.LogFunctionEndDebug(me.ToString());
403  }
404  else
405  {
406  this.MyLogger.LogFunctionEndDebug();
407  }
408  }
409 
410  return me;
411  }
412 
427  public virtual bool MemorizeExists()
428  {
429  bool bOK = false;
430  bool lvbReturn = false;
431 
432  try
433  {
434  this.MyLogger.LogFunctionStartDebug("MemorizeExists");
435 
436  lvbReturn = this.GetExists();
437  bOK = true;
438  }
439  finally
440  {
441  if (bOK)
442  {
443  this.MyLogger.LogFunctionEndDebug(lvbReturn);
444  }
445  else
446  {
447  this.MyLogger.LogFunctionEndDebug();
448  }
449  }
450 
451  return lvbReturn;
452  }
453 
465  public virtual bool MemorizeIsActive()
466  {
467  bool bOK = false;
468  bool lvbReturn = false;
469 
470  try
471  {
472  this.MyLogger.LogFunctionStartDebug("MemorizeIsActive");
473 
474  lvbReturn = this.GetIsActive();
475  bOK = true;
476  }
477  finally
478  {
479  if (bOK)
480  {
481  this.MyLogger.LogFunctionEndDebug(lvbReturn);
482  }
483  else
484  {
485  this.MyLogger.LogFunctionEndDebug();
486  }
487  }
488 
489  return lvbReturn;
490  }
491 
504  public virtual bool NotExists()
505  {
506  this.MyLogger.LogFunctionStartDebug("Exists");
507  bool lvb_Return = false;
508  bool bOK = false;
509 
510  try
511  {
512  this.Me();
513  lvb_Return = true;
514  bOK = true;
515  }
516  catch (NoSuchElementException)
517  {
518  this.MyLogger.LogPrint("NoSuchElementException");
519  lvb_Return = true;
520  bOK = true;
521  }
522  finally
523  {
524  if (bOK)
525  {
526  this.MyLogger.LogFunctionEndDebug(lvb_Return);
527  }
528  else
529  {
530  this.MyLogger.LogFunctionEndDebug();
531  }
532  }
533 
534  return lvb_Return;
535  }
536 
549  public virtual void SetFocus()
550  {
551  this.LogFunctionStartDebug("SetFocus");
552 
553  try
554  {
555  // Wenn das Objekt nicht existiert mit Exception beenden...
556  if (!this.GetExists())
557  {
558  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "SetFocus()");
559  throw new OKWGUIObjectNotFoundException(lvsLM);
560  }
561 
562  this.Me().SendKeys(string.Empty);
563  }
564  finally
565  {
566  this.LogFunctionEndDebug();
567  }
568 
569  return;
570  }
571 
582  public virtual void TypeKey(List<string> fps_Values)
583  {
584  try
585  {
586  this.LogFunctionStartDebug("TypeKey", "fps_Values", fps_Values.ToString());
587 
588  // Wenn das Objekt nicht existiert mit Exception beenden...
589  if (!this.GetExists())
590  {
591  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "SeAnyWin.TypeKey()");
592  throw new OKWGUIObjectNotFoundException(lvsLM);
593  }
594 
595  // We are using a local-Variable to prevent multiple call of Me() in foreach-loop
596  IWebElement lv_WebElement = this.Me();
597 
598  // Loop through all List-Values with foreach...
599  foreach (string lvsValue in fps_Values)
600  {
601  Logger.Instance.LogPrintDebug(">>" + lvsValue + "<<");
602  lv_WebElement.SendKeys(lvsValue);
603  }
604  }
605  finally
606  {
607  this.LogFunctionEndDebug();
608  }
609 
610  return;
611  }
612 
632  public virtual bool VerifyExists(bool fpbExpectedValue)
633  {
634  this.MyLogger.LogFunctionStartDebug("VerifyExists", "fpbExpectedValue", fpbExpectedValue.ToString());
635 
636  bool lvbReturn = true;
637  bool bOK = false;
638 
639  try
640  {
641  // GetExists als delegaten definieren
642  OKW_Wait4Value.BoolCallBack myCallBack = this.GetExists;
643 
644  // Nun mit dem erwarteten Sollwert und GetExists ggf. auf den erwartetetn Wert warten.
645  lvbReturn = this.MyWait4Value.Wait4Value(fpbExpectedValue, myCallBack);
646 
647  if (fpbExpectedValue == true && lvbReturn != fpbExpectedValue )
648  {
649  this.MyLogger.LogPrint( string.Format( "Locator: >>{0}<<", this.Locator) );
650  }
651 
652  bOK = true;
653  }
654  finally
655  {
656  if (bOK)
657  {
658  this.MyLogger.LogFunctionEndDebug(lvbReturn);
659  }
660  else
661  {
662  this.MyLogger.LogFunctionEndDebug();
663  }
664  }
665 
666  return lvbReturn;
667  }
668 
680  public virtual bool VerifyIsActive(bool fpbExpectedValue)
681  {
682  this.MyLogger.LogFunctionStartDebug("VerifyIsActive", "fpbExpectedValue", fpbExpectedValue.ToString());
683 
684  bool lvbReturn = true;
685  bool bOK = false;
686 
687  try
688  {
689  // GetExists als delegaten definieren
690  OKW_Wait4Value.BoolCallBack myCallBack = this.GetIsActive;
691 
692  // Nun mit dem erwarteten Sollwert und GetIsActive ggf. auf den erwarteten Wert warten.
693  lvbReturn = this.MyWait4Value.Wait4Value(fpbExpectedValue, myCallBack);
694 
695  bOK = true;
696  }
697  finally
698  {
699  if (bOK)
700  {
701  this.MyLogger.LogFunctionEndDebug(lvbReturn);
702  }
703  else
704  {
705  this.MyLogger.LogFunctionEndDebug();
706  }
707  }
708 
709  return lvbReturn;
710  }
711 
726  public virtual List<string> VerifyTooltip(List<string> fplsExpectedValue)
727  {
728  MyLogger.LogFunctionStartDebug("VerifyTooltip", "fplsExpectedValue", fplsExpectedValue[0]);
729 
730  List<string> lvLsReturn = new List<string>();
731  bool bOK = false;
732 
733  try
734  {
735  // GetValue_TOOLTIP als delegaten definieren
736  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetTooltip;
737 
738  // Nun mit dem erwarteten Sollwert und GetValue_TOOLTIP ggf. auf den Wert Warten.
739  lvLsReturn = MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
740 
741  bOK = true;
742  }
743  finally
744  {
745  if (bOK)
746  {
747  MyLogger.LogFunctionEndDebug(lvLsReturn);
748  }
749  else
750  {
751  MyLogger.LogFunctionEndDebug();
752  }
753  }
754 
755  return lvLsReturn;
756  }
757 
776  public virtual List<string> VerifyLabel(List<string> fplsExpectedValue)
777  {
778  MyLogger.LogFunctionStartDebug("VerifyLabel", "fplsExpectedValue", fplsExpectedValue[0]);
779 
780  List<string> lvLsReturn = new List<string>();
781  bool bOK = false;
782 
783  try
784  {
785  // GetLabel als delegaten definieren
786  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetLabel;
787 
788  // Nun mit dem erwarteten Sollwert und GetValue_TOOLTIP ggf. auf den Wert Warten.
789  lvLsReturn = MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
790 
791  bOK = true;
792  }
793  finally
794  {
795  if (bOK)
796  {
797  MyLogger.LogFunctionEndDebug(lvLsReturn);
798  }
799  else
800  {
801  MyLogger.LogFunctionEndDebug();
802  }
803  }
804 
805  return lvLsReturn;
806  }
807 
808 
820  public virtual List<string> GetTooltip()
821  {
822  List<string> lvLsReturn = new List<string>();
823  bool bOK = false;
824  try
825  {
826  MyLogger.LogFunctionStartDebug("GetTooltip");
827 
828  // Wenn das Objekt nicht existiert mit Exception beenden...
829  if (!this.GetExists())
830  {
831  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "GetTooltip()");
832  throw new OKWGUIObjectNotFoundException(lvsLM);
833  }
834 
835  // The Attribute "Title" is shown as Tooltip...
836  lvLsReturn.Add(this.Me().GetAttribute("title"));
837  bOK = true;
838  }
839  finally
840  {
841  if (bOK)
842  {
843  MyLogger.LogFunctionEndDebug(lvLsReturn);
844  }
845  else
846  {
847  MyLogger.LogFunctionEndDebug();
848  }
849  }
850 
851  return lvLsReturn;
852  }
853 
854 
866  public virtual List<string> GetLabel()
867  {
868  List<string> lvLsReturn = new List<string>();
869  bool bOK = false;
870  try
871  {
872  MyLogger.LogFunctionStartDebug("GetTooltip");
873 
874  // Wenn das Objekt nicht existiert mit Exception beenden...
875  if (!this.GetExists())
876  {
877  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "GetTooltip()");
878  throw new OKWGUIObjectNotFoundException(lvsLM);
879  }
880 
881  // 1. Schritt: Attribute "id" is shown as Tooltip...
882  string lvsID = this.Me().GetAttribute("id");
883 
884  // 2.schritt nun Tag Label mit for= "${lvsID}" finden.
885  IWebElement label = SeDriver.Instance.driver.FindElement(By.XPath( "//label[@for='" + lvsID + "']" ));
886  lvLsReturn.Add(label.GetAttribute("textContent"));
887  bOK = true;
888  }
889  finally
890  {
891  if (bOK)
892  {
893  MyLogger.LogFunctionEndDebug(lvLsReturn);
894  }
895  else
896  {
897  MyLogger.LogFunctionEndDebug();
898  }
899  }
900 
901  return lvLsReturn;
902  }
903 
918  public virtual List<string> LogTooltip()
919  {
920  List<string> lvLsReturn = new List<string>();
921  bool bOK = false;
922 
923  try
924  {
925  MyLogger.LogFunctionStartDebug("LogTooltip");
926 
927  lvLsReturn = this.GetTooltip();
928 
929  bOK = true;
930  }
931  finally
932  {
933  if (bOK)
934  {
935  MyLogger.LogFunctionEndDebug(lvLsReturn);
936  }
937  else
938  {
939  MyLogger.LogFunctionEndDebug();
940  }
941  }
942 
943  return lvLsReturn;
944  }
945 
960  public virtual List<string> LogLabel()
961  {
962  List<string> lvLsReturn = new List<string>();
963  bool bOK = false;
964 
965  try
966  {
967  MyLogger.LogFunctionStartDebug("LogLabel");
968 
969  lvLsReturn = this.GetLabel();
970 
971  bOK = true;
972  }
973  finally
974  {
975  if (bOK)
976  {
977  MyLogger.LogFunctionEndDebug(lvLsReturn);
978  }
979  else
980  {
981  MyLogger.LogFunctionEndDebug();
982  }
983  }
984 
985  return lvLsReturn;
986  }
987 
1002  public virtual List<string> MemorizeTooltip()
1003  {
1004  bool bOK = false;
1005  List<string> lvLsReturn = null;
1006 
1007  try
1008  {
1009  MyLogger.LogFunctionStartDebug("MemorizeTooltip");
1010 
1011  lvLsReturn = this.GetTooltip();
1012  bOK = true;
1013  }
1014  finally
1015  {
1016  if (bOK)
1017  {
1018  MyLogger.LogFunctionEndDebug(lvLsReturn);
1019  }
1020  else
1021  {
1022  MyLogger.LogFunctionEndDebug();
1023  }
1024  }
1025 
1026  return lvLsReturn;
1027  }
1028 
1043  public virtual List<string> MemorizeLabel()
1044  {
1045  bool bOK = false;
1046  List<string> lvLsReturn = null;
1047 
1048  try
1049  {
1050  MyLogger.LogFunctionStartDebug("MemorizeLabel");
1051 
1052  lvLsReturn = this.GetLabel();
1053  bOK = true;
1054  }
1055  finally
1056  {
1057  if (bOK)
1058  {
1059  MyLogger.LogFunctionEndDebug(lvLsReturn);
1060  }
1061  else
1062  {
1063  MyLogger.LogFunctionEndDebug();
1064  }
1065  }
1066 
1067  return lvLsReturn;
1068  }
1069 
1079  public virtual bool GetHasFocus()
1080  {
1081  bool lvbReturn = false;
1082  bool bOK = false;
1083 
1084  try
1085  {
1086  this.LogFunctionStartDebug("GetHasFocus");
1087 
1088  // Wenn das Objekt nicht existiert mit Exception beenden...
1089  if (!this.GetExists())
1090  {
1091  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "GetTooltip()");
1092  throw new OKWGUIObjectNotFoundException(lvsLM);
1093  }
1094 
1095  IWebElement currentElement = SeDriver.Instance.driver.SwitchTo().ActiveElement();
1096 
1097  lvbReturn = currentElement.Equals(this.Me());
1098  bOK = true;
1099  }
1100  finally
1101  {
1102  if (bOK)
1103  {
1104  MyLogger.LogFunctionEndDebug(lvbReturn);
1105  }
1106  else
1107  {
1108  MyLogger.LogFunctionEndDebug();
1109  }
1110  }
1111 
1112  return lvbReturn;
1113  }
1114 
1125  public virtual bool LogHasFocus()
1126  {
1127  bool lvbReturn = false;
1128  bool bOK = false;
1129 
1130  try
1131  {
1132  this.LogFunctionStartDebug("LogHasFocus");
1133 
1134  lvbReturn = this.GetHasFocus();
1135  bOK = true;
1136  }
1137  finally
1138  {
1139  if (bOK)
1140  {
1141  MyLogger.LogFunctionEndDebug(lvbReturn);
1142  }
1143  else
1144  {
1145  MyLogger.LogFunctionEndDebug();
1146  }
1147  }
1148 
1149  return lvbReturn;
1150  }
1151 
1165  public virtual bool MemorizeHasFocus()
1166  {
1167  bool lvbReturn = false;
1168  bool bOK = false;
1169 
1170  try
1171  {
1172  this.LogFunctionStartDebug("MemorizeHasFocus");
1173 
1174  lvbReturn = this.GetHasFocus();
1175  bOK = true;
1176  }
1177  finally
1178  {
1179  if (bOK)
1180  {
1181  MyLogger.LogFunctionEndDebug(lvbReturn);
1182  }
1183  else
1184  {
1185  MyLogger.LogFunctionEndDebug();
1186  }
1187  }
1188 
1189  return lvbReturn;
1190  }
1191 
1202  public virtual bool VerifyHasFocus(bool fpbExpectedValue)
1203  {
1204  bool lvbReturn = false;
1205  bool bOK = false;
1206 
1207  try
1208  {
1209  MyLogger.LogFunctionStartDebug("VerifyHasFocus", "fpbExpectedValue", fpbExpectedValue.ToString());
1210 
1211  // GetValue_TOOLTIP als delegaten definieren
1212  OKW_Wait4Value.BoolCallBack myCallBack = this.GetHasFocus;
1213 
1214  // Nun mit dem erwarteten Sollwert und GetHasFocus ggf. auf den Wert Warten.
1215  lvbReturn = MyWait4Value.Wait4Value(fpbExpectedValue, myCallBack);
1216  bOK = true;
1217  }
1218  finally
1219  {
1220  if (bOK)
1221  {
1222  MyLogger.LogFunctionEndDebug(lvbReturn);
1223  }
1224  else
1225  {
1226  MyLogger.LogFunctionEndDebug();
1227  }
1228  }
1229 
1230  return lvbReturn;
1231  }
1232 
1247  public virtual List<string> VerifyCaption(List<string> fplsExpectedValue)
1248  {
1249  MyLogger.LogFunctionStartDebug("VerifyCaption", "fplsExpectedValue", fplsExpectedValue[0]);
1250 
1251  List<string> lvLsReturn = new List<string>();
1252  bool bOK = false;
1253 
1254  try
1255  {
1256  // GetValue_TOOLTIP als delegaten definieren
1257  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetCaption;
1258 
1259  // Nun mit dem erwarteten Sollwert und GetValue_TOOLTIP ggf. auf den Wert Warten.
1260  lvLsReturn = MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
1261 
1262  bOK = true;
1263  }
1264  finally
1265  {
1266  if (bOK)
1267  {
1268  MyLogger.LogFunctionEndDebug(lvLsReturn);
1269  }
1270  else
1271  {
1272  MyLogger.LogFunctionEndDebug();
1273  }
1274  }
1275 
1276  return lvLsReturn;
1277  }
1278 
1293  public virtual List<string> LogCaption()
1294  {
1295  List<string> lvLsReturn = new List<string>();
1296  bool bOK = false;
1297 
1298  try
1299  {
1300  MyLogger.LogFunctionStartDebug("LogCaption");
1301 
1302  lvLsReturn = this.GetCaption();
1303 
1304  bOK = true;
1305  }
1306  finally
1307  {
1308  if (bOK)
1309  {
1310  MyLogger.LogFunctionEndDebug(lvLsReturn);
1311  }
1312  else
1313  {
1314  MyLogger.LogFunctionEndDebug();
1315  }
1316  }
1317 
1318  return lvLsReturn;
1319  }
1320 
1335  public virtual List<string> MemorizeCaption()
1336  {
1337  bool bOK = false;
1338  List<string> lvLsReturn = null;
1339 
1340  try
1341  {
1342  MyLogger.LogFunctionStartDebug("MemorizeCaption");
1343 
1344  lvLsReturn = this.GetCaption();
1345  bOK = true;
1346  }
1347  finally
1348  {
1349  if (bOK)
1350  {
1351  MyLogger.LogFunctionEndDebug(lvLsReturn);
1352  }
1353  else
1354  {
1355  MyLogger.LogFunctionEndDebug();
1356  }
1357  }
1358 
1359  return lvLsReturn;
1360  }
1361 
1373  public virtual List<string> GetCaption()
1374  {
1375  List<string> lvLsReturn = new List<string>();
1376  bool bOK = false;
1377  try
1378  {
1379  MyLogger.LogFunctionStartDebug("GetCaption");
1380 
1381  // Wenn das Objekt nicht existiert mit Exception beenden...
1382  if (!this.GetExists())
1383  {
1384  string lvsLM = this.LM.GetMessage("Common", "OKWGUIObjectNotFoundException", "GetCaption()");
1385  throw new OKWGUIObjectNotFoundException(lvsLM);
1386  }
1387 
1388  // The Attribute "value" wird als Beschriftung angezeigt...
1389  lvLsReturn.Add(this.Me().GetAttribute("textContent"));
1390  bOK = true;
1391  }
1392  finally
1393  {
1394  if (bOK)
1395  {
1396  MyLogger.LogFunctionEndDebug(lvLsReturn);
1397  }
1398  else
1399  {
1400  MyLogger.LogFunctionEndDebug();
1401  }
1402  }
1403 
1404  return lvLsReturn;
1405  }
1406 
1413  public virtual List<string> GetValue()
1414  {
1415  List<string> lvLsReturn = new List<string>();
1416  bool bOK = false;
1417 
1418  try
1419  {
1420  this.LogFunctionStartDebug("GetValue");
1421 
1422  // Get Value from TextField and put this into the return List<string>
1423  lvLsReturn.Add(this.Me().GetAttribute("textContent"));
1424  bOK = true;
1425  }
1426  finally
1427  {
1428  if (bOK)
1429  {
1430  this.LogFunctionEndDebug(lvLsReturn.ToString());
1431  }
1432  else
1433  {
1434  this.LogFunctionEndDebug();
1435  }
1436  }
1437 
1438  return lvLsReturn;
1439  }
1440 
1451  public virtual List<string> LogValue()
1452  {
1453  bool bOK = false;
1454  List<string> lvLsReturn = new List<string>();
1455 
1456  try
1457  {
1458  MyLogger.LogFunctionStartDebug("LogValue");
1459  lvLsReturn = this.GetValue();
1460  bOK = true;
1461  }
1462  finally
1463  {
1464  if (bOK)
1465  {
1466  MyLogger.LogFunctionEndDebug(lvLsReturn);
1467  }
1468  else
1469  {
1470  MyLogger.LogFunctionEndDebug();
1471  }
1472  }
1473 
1474  return lvLsReturn;
1475  }
1476 
1491  public virtual List<string> MemorizeValue()
1492  {
1493  List<string> lvLsReturn = new List<string>();
1494  bool bOK = false;
1495 
1496  try
1497  {
1498  MyLogger.LogFunctionStartDebug("Memorize");
1499  lvLsReturn = this.GetValue();
1500  bOK = true;
1501  }
1502  finally
1503  {
1504  if (bOK)
1505  {
1506  MyLogger.LogFunctionEndDebug(lvLsReturn);
1507  }
1508  else
1509  {
1510  MyLogger.LogFunctionEndDebug();
1511  }
1512  }
1513 
1514  return lvLsReturn;
1515  }
1516 
1528  public virtual List<string> VerifyValue(List<string> fplsExpectedValue)
1529  {
1530  List<string> lvLsReturn = new List<string>();
1531  bool bOK = false;
1532 
1533  try
1534  {
1535  MyLogger.LogFunctionStartDebug("Memorize", "fplsExpectedValue", fplsExpectedValue[0]);
1536 
1537  // GetValue als delegaten definieren
1538  OKW_Wait4Value.ListStringCallBack myCallBack = this.GetValue;
1539 
1540  // Nun mit dem erwarteten Sollwert und GetValue ggf. auf den Wert Warten.
1541  lvLsReturn = MyWait4Value.Wait4Value(fplsExpectedValue, myCallBack);
1542 
1543  bOK = true;
1544  }
1545  finally
1546  {
1547  if (bOK)
1548  {
1549  MyLogger.LogFunctionEndDebug(lvLsReturn);
1550  }
1551  else
1552  {
1553  MyLogger.LogFunctionEndDebug();
1554  }
1555  }
1556 
1557  return lvLsReturn;
1558  }
1559 
1560 
1561  #endregion Methods
1562  }
1563  }
virtual void SetFocus()
Setzt den Focus auf das Objekt. Anmerkung: Kleiner Trick: Selenium kennt keine öffentliche c#-Methode...
Definition: SeAnyWin.cs:549
virtual List< string > LogCaption()
Ermittelt den textuellen Inhalt der Beschriftung (Caption).
Definition: SeAnyWin.cs:1293
string GetMessage(string MethodName, string TextKey)
Holt die Log-Meldung für MethodeNmae/Textkey ohne weitere Parameter.
virtual bool VerifyHasFocus(bool fpbExpectedValue)
Ermittelt den textuellen Inhalt des ToolTips.
Definition: SeAnyWin.cs:1202
static SeDriver Instance
Gibt die Instance für die einzige Instanz dieser Klasse zurück. Hinweis:
Definition: SeDriver.cs:93
virtual List< string > VerifyLabel(List< string > fplsExpectedValue)
Ermittelt den textuellen Inhalt des Labels für Prüfewert.
Definition: SeAnyWin.cs:776
virtual bool MemorizeExists()
Ermittelt ob das Atuelle Objekt existiert, für das Schlüsselwort MerkeVorhanden.
Definition: SeAnyWin.cs:427
virtual List< string > GetLabel()
Ermittelt den textuellen Inhalt des Labels.
Definition: SeAnyWin.cs:866
virtual List< string > MemorizeTooltip()
Ermittelt den textuellen Inhalt des ToolTips für das Schlüsselwort MerkeWert.
Definition: SeAnyWin.cs:1002
delegate List< string > ListStringCallBack()
Callback Muster string Variante.
virtual List< string > LogValue()
Ermittelt den Wert des Objktes für das Schlüsselwort Loggewert.
Definition: SeAnyWin.cs:1451
virtual bool MemorizeIsActive()
Ermittelt für das Schlüsselwort MerkeIstAktive, ob das aktuelle Objekt aktiv ist. ...
Definition: SeAnyWin.cs:465
Diese Ausnahme wird ausgelöst, wenn ein GUI-Objekt zu den im Frame gegebenen Objekterkennungseigensch...
Erweiterung des IWebelemets.
Definition: SeAnyWin.cs:64
virtual List< string > MemorizeLabel()
Ermittelt den textuellen Inhalt des Labels für das Schlüsselwort MerkeWert.
Definition: SeAnyWin.cs:1043
virtual bool NotExists()
Prüft die nicht Existenz des aktuellen Objektes. Anmerkung: Falls ein Objekt zunächst noch vorhand is...
Definition: SeAnyWin.cs:504
virtual bool VerifyIsActive(bool fpbExpectedValue)
Ermittelt/Prüft, ob das aktuelle Objekt aktiv ist.
Definition: SeAnyWin.cs:680
virtual bool GetHasFocus()
Methode liefert den aktuellen Zustand Wert des Focus. Quelle: http://stackoverflow.com/questions/7491806/in-selenium-how-do-i-find-the-current-object.
Definition: SeAnyWin.cs:1079
virtual List< string > GetValue()
Holt den aktuellen Text aus einem HTML-Tag.
Definition: SeAnyWin.cs:1413
virtual List< string > LogTooltip()
Logt den textuellen Inhalt des ToolTips.
Definition: SeAnyWin.cs:918
virtual bool MemorizeHasFocus()
Ermittelt ob das Objekt den Fokus besitz und liefert diesen für das Schlüsselwort MerkeWert...
Definition: SeAnyWin.cs:1165
virtual bool LogExists()
Ermittelt den textuellen Inhalt des ToolTips.
Definition: SeAnyWin.cs:281
virtual List< string > VerifyTooltip(List< string > fplsExpectedValue)
Ermittelt den textuellen Inhalt des ToolTips für Prüfewert.
Definition: SeAnyWin.cs:726
OKW_Wait4Value ist die zetrale Klasse, die für das Warten auf GUI eigenschaften zuständig ist...
virtual List< string > GetCaption()
Ermittelt den textuellen Inhalt der Caption/Überschrift des Objektes.
Definition: SeAnyWin.cs:1373
virtual bool LogIsActive()
Ermittelt, ob das aktuelle Objket Aktiv ist.
Definition: SeAnyWin.cs:323
string Wait4Value(string fpExpected, StringCallBack fpCallMeBack)
Methode liest den Wert aus der deligierten Methode fpCallMeBack wartet ggf. und liefert den Wert zurü...
virtual List< string > MemorizeValue()
Ermittelt den Wert, im Allgemeinen den textuellen Inhalt eines Objektes für das Schlüsselwort MerkeWe...
Definition: SeAnyWin.cs:1491
virtual IWebElement Me()
Ermittelt aus dem gegebenen Locator das DOM-Elelement, welches das Objekt representiert.
Definition: SeAnyWin.cs:359
virtual List< string > LogLabel()
Logt den textuellen Inhalt des Labels eines Objektes.
Definition: SeAnyWin.cs:960
Description of AnyWin.
Definition: AnyWinBase.cs:55
delegate bool BoolCallBack()
Callback Muster string Variante.
LogMessenger liest Log-Meldungen sprachspezifisch für die im Konstruktor gegeben Klasse aus der Zugeh...
Definition: LogMessenger.cs:90
void LogPrintDebug(string fpsMessage)
Loggt eine Nachricht.
Definition: Logger.cs:332
virtual bool GetIsActive()
Prüft, ob das aktuellen Objekt aktiv ist.
Definition: SeAnyWin.cs:222
virtual bool GetExists()
Prüft die Existenz des Aktuellen Objektes.
Definition: SeAnyWin.cs:181
Description of OKWLocator.
Definition: OKWLocator.cs:52
virtual void ClickOn()
Klickt auf das aktuelle Objekt.
Definition: SeAnyWin.cs:150
virtual List< string > VerifyCaption(List< string > fplsExpectedValue)
Ermittelt den textuellen Inhalt des ToolTips für Prüfewert.
Definition: SeAnyWin.cs:1247
virtual bool VerifyExists(bool fpbExpectedValue)
Ermittelt/Prüft, ob das aktuelle Objekt existiert.
Definition: SeAnyWin.cs:632
virtual List< string > GetTooltip()
Ermittelt den textuellen Inhalt des ToolTips.
Definition: SeAnyWin.cs:820
virtual List< string > VerifyValue(List< string > fplsExpectedValue)
Ermittelt den textuellen Inhalt des markierten Textes für Prüfewert.
Definition: SeAnyWin.cs:1528
virtual List< string > MemorizeCaption()
Ermittelt den textuellen Inhalt des Caption/Überschrift für das Schlüsselwort MerkeWert.
Definition: SeAnyWin.cs:1335
virtual bool LogHasFocus()
Ermittelt für LoggeWert, ob das aktuelle Objekt den Fokus hat.
Definition: SeAnyWin.cs:1125
virtual void TypeKey(List< string > fps_Values)
Tastatur Eingabe an das Objekt.
Definition: SeAnyWin.cs:582
Pattern Singelton.
Definition: SeDriver.cs:56
Definition: Core.cs:40