Skip to content

Commit 5783fb4

Browse files
committed
Started to add the ControlBase class. No ready to run yet.
1 parent dca991b commit 5783fb4

File tree

4 files changed

+91
-12
lines changed

4 files changed

+91
-12
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Controlium.iml

+12-11
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@
88
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
99
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
1010
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
11-
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" />
11+
<sourceFolder url="file://$MODULE_DIR$/src/Test" isTestSource="true" />
12+
<sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" />
1213
<excludeFolder url="file://$MODULE_DIR$/target" />
1314
</content>
1415
<orderEntry type="inheritedJdk" />
1516
<orderEntry type="sourceFolder" forTests="false" />
16-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-java:3.10.0" level="project" />
17-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-api:3.10.0" level="project" />
18-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-chrome-driver:3.10.0" level="project" />
19-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-edge-driver:3.10.0" level="project" />
20-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-firefox-driver:3.10.0" level="project" />
21-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-ie-driver:3.10.0" level="project" />
22-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-opera-driver:3.10.0" level="project" />
23-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-remote-driver:3.10.0" level="project" />
24-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-safari-driver:3.10.0" level="project" />
25-
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-support:3.10.0" level="project" />
17+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-java:3.11.0" level="project" />
18+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-api:3.11.0" level="project" />
19+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-chrome-driver:3.11.0" level="project" />
20+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-edge-driver:3.11.0" level="project" />
21+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-firefox-driver:3.11.0" level="project" />
22+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-ie-driver:3.11.0" level="project" />
23+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-opera-driver:3.11.0" level="project" />
24+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-remote-driver:3.11.0" level="project" />
25+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-safari-driver:3.11.0" level="project" />
26+
<orderEntry type="library" name="Maven: org.seleniumhq.selenium:selenium-support:3.11.0" level="project" />
2627
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.7.9" level="project" />
2728
<orderEntry type="library" name="Maven: org.apache.commons:commons-exec:1.3" level="project" />
2829
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package TeamControlium.Controlium;
2+
3+
4+
import org.apache.http.MethodNotSupportedException;
5+
6+
import java.util.Objects;
7+
8+
/// <summary>An abstract Core control all other Core controls inherit from. Contains all methods and properties that are common to TeamControlium controls.
9+
/// <para/><para/>It should be noted that it is possible to perform an illegal action against a control. As an example, calling SetText (See <see cref="SetText(FindBy, string, string)"/> or <see cref="SetText(string)"/>) against a TeamControlium button
10+
/// control will result in an exception. It is the responsibility of the Test code to call only legal actions against a TeamControlium control. Controls may extend these methods and properties
11+
/// depending on the functionality of the control; for example, a Dropdown control driver may have a SelectItem(Iten identification) method to select a dropdown item.</summary>
12+
public abstract class ControlBase {
13+
14+
15+
private ObjectMapping _Mapping;
16+
public ObjectMapping getMapping() {
17+
return _Mapping;
18+
}
19+
protected ObjectMapping setMapping(ObjectMapping mapping) {
20+
_Mapping=mapping;
21+
return _Mapping;
22+
}
23+
24+
private HTMLElement _RootElement;
25+
public HTMLElement getRootElement() {
26+
if (_RootElement == null) {
27+
throw new RuntimeException(String.format("Control [%s] root element NULL. Has control been located on the page (IE. SetControl(...)?",getMapping().getFriendlyName()));
28+
}
29+
else {
30+
return _RootElement;
31+
}
32+
}
33+
protected HTMLElement setRootElement(HTMLElement element) {
34+
_RootElement = element;
35+
setMapping(element.getMappingDetails());
36+
return _RootElement;
37+
}
38+
protected HTMLElement setRootElement(ObjectMapping mapping) {
39+
setRootElement(new HTMLElement(mapping));
40+
return _RootElement;
41+
}
42+
43+
private SeleniumDriver _SeleniumDriver;
44+
public SeleniumDriver getSeleniumDriver() {
45+
return _SeleniumDriver;
46+
}
47+
private SeleniumDriver setSeleniumDriver(SeleniumDriver seleniumDriver) {
48+
_SeleniumDriver = seleniumDriver;
49+
return _SeleniumDriver;
50+
}
51+
52+
public static void clearCache() {
53+
throw new RuntimeException("No caching implemented yet!");
54+
}
55+
56+
57+
//
58+
// Sets on a child control with the childs find logic being applied this controls root element.
59+
// Method can be overridden by control implementations.
60+
//
61+
62+
63+
}

src/main/java/TeamControlium/Controlium/HTMLElement.java

+15
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public String toString() {
3535

3636

3737
// Constructors
38+
39+
//
40+
// Create an instance of an Element. It has no mapping, no Parent and has not yet been located in a DOM
41+
//
42+
//
3843
public HTMLElement() {
3944
}
4045

@@ -44,6 +49,16 @@ public HTMLElement(Object parent, Object underlyingWebElement, ObjectMapping map
4449
setUnderlyingWebElement(underlyingWebElement);
4550
}
4651

52+
//
53+
// Create an instance of an Element. The mapping is set but it has no Parent and has not yet been located in a DOM
54+
//
55+
//
56+
public HTMLElement(ObjectMapping mapping) {
57+
setParentOfThisElement(null);
58+
setMappingDetails(mapping);
59+
setUnderlyingWebElement(null);
60+
}
61+
4762

4863
// PROPERTIES
4964
public String getFriendlyName() {

0 commit comments

Comments
 (0)