OpenKeyWord
Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
fourTestLocator.java
1
package
okw;
2
3
public
class
fourTestLocator
4
{
5
public
fourTestLocator
( String fspL )
6
{
7
super();
8
this.
get4TestLocator
( fspL );
9
}
10
11
private
String cvsGUIClass =
null
;
12
private
String cvsLocator =
null
;
13
14
30
public
String
get4TestLocator
( String fspL )
31
{
32
String lvsReturn = fspL;
33
String LogMessage =
""
;
34
35
if
( fspL.startsWith(
"4T!"
) )
36
{
37
// Find object with data-4test attribute
38
LogMessage =
"Generate '@data-4test' Locator"
;
39
seperateClassnameAndLocator
( fspL.replaceFirst(
"4T!"
,
""
) );
40
lvsReturn =
"//*[@data-4test='"
+ this.cvsLocator +
"']"
;
41
}
42
else
if
( fspL.startsWith(
"4TAI!"
) )
43
{
44
// Find object with label than contains text
45
LogMessage =
"Generate '@AutomationID' Locator"
;
46
seperateClassnameAndLocator
( fspL.replaceFirst(
"4TAI!"
,
""
) );
47
lvsReturn =
"//*[@AutomationID='"
+ this.cvsLocator +
"']"
;
48
}
49
else
if
( fspL.startsWith(
"4TNA!"
) )
50
{
51
// Find object with label than contains text
52
LogMessage =
"Generate '@name' Locator"
;
53
seperateClassnameAndLocator
( fspL.replaceFirst(
"4TNA!"
,
""
) );
54
lvsReturn =
"//*[contains(@name,'"
+ this.cvsLocator +
"')]"
;
55
}
56
else
if
( fspL.startsWith(
"4TID!"
) )
57
{
58
// Find object with label than contains text
59
LogMessage =
"Generate '@id' Locator"
;
60
seperateClassnameAndLocator
( fspL.replaceFirst(
"4TID!"
,
""
) );
61
lvsReturn =
"//*[contains(@id,'"
+ this.cvsLocator +
"')]"
;
62
}
63
else
if
( fspL.startsWith(
"4TLA!"
) )
64
{
65
// Find object with label than contains text
66
LogMessage =
"Generate 'label' Locator"
;
67
seperateClassnameAndLocator
( fspL.replaceFirst(
"4TLA!"
,
""
) );
68
lvsReturn =
"//label[contains(text(),'"
+ this.cvsLocator +
"')]/following-sibling::input"
;
69
}
70
else
if
( fspL.startsWith(
"4TTX!"
) )
71
{
72
// Find object with label than contains text
73
LogMessage =
"Generate 'Contains Text' Locator"
;
74
seperateClassnameAndLocator
( fspL.replaceFirst(
"4TTX!"
,
""
) );
75
lvsReturn =
"//*[contains(text(),'"
+ this.cvsLocator +
"')]"
;
76
}
77
78
this.cvsLocator = lvsReturn;
79
80
return
lvsReturn;
81
}
82
92
public
int
seperateClassnameAndLocator
( String fpsLocator )
93
{
94
int
iReturn = 0;
95
96
String[] MySplit = fpsLocator.split(
"::"
);
97
98
if
( MySplit.length == 1 )
99
{
100
cvsLocator = MySplit[0];
101
}
102
103
else
if
( MySplit.length == 2 )
104
{
105
cvsGUIClass= MySplit[0];
106
cvsLocator = MySplit[1];
107
}
108
else
109
{
110
iReturn = -1;
111
}
112
113
return
iReturn;
114
}
115
116
public
String getGUIClass() {
117
return
cvsGUIClass;
118
}
119
120
public
String getLocator()
121
{
122
return
cvsLocator;
123
}
124
}
125
okw.fourTestLocator
Definition:
fourTestLocator.java:3
okw.fourTestLocator.seperateClassnameAndLocator
int seperateClassnameAndLocator(String fpsLocator)
Trennt den Klassenbezeichner vom Locator ab.
Definition:
fourTestLocator.java:92
okw.fourTestLocator.get4TestLocator
String get4TestLocator(String fspL)
Erzeugt einen locator aus dem gegebenen Wert, wenn fspL mit "4T!", "4T:" oder "4T?...
Definition:
fourTestLocator.java:30
core
src
main
java
okw
fourTestLocator.java
Erzeugt am Don Jan 2 2020 07:47:04 für OpenKeyWord von
1.8.16