17
17
18
18
package org .openqa .selenium ;
19
19
20
+ import org .junit .Test ;
21
+ import org .junit .experimental .categories .Category ;
22
+ import org .openqa .selenium .json .Json ;
23
+ import org .openqa .selenium .testing .UnitTests ;
24
+
25
+ import java .util .List ;
26
+ import java .util .Map ;
27
+
20
28
import static org .assertj .core .api .Assertions .assertThat ;
21
29
import static org .mockito .Mockito .mock ;
22
30
import static org .mockito .Mockito .verify ;
31
39
import static org .openqa .selenium .By .ByXPath ;
32
40
import static org .openqa .selenium .json .Json .MAP_TYPE ;
33
41
34
- import java .util .List ;
35
- import java .util .Map ;
36
- import org .junit .Test ;
37
- import org .junit .experimental .categories .Category ;
38
- import org .openqa .selenium .json .Json ;
39
- import org .openqa .selenium .testing .UnitTests ;
40
-
41
42
@ Category (UnitTests .class )
42
43
public class ByTest {
43
44
@@ -64,30 +65,6 @@ public void shouldUseXpathLocateElementsByXpath() {
64
65
verify (driver ).findElements (By .xpath (".//*[@name = 'peas']" ));
65
66
verifyNoMoreInteractions (driver );
66
67
}
67
- //
68
- // @Test
69
- // public void shouldUseXPathToFindByNameIfDriverDoesNotImplementFindsByName() {
70
- // final OnlyXPath driver = mock(OnlyXPath.class);
71
- //
72
- // By.name("cheese").findElement(driver);
73
- // By.name("peas").findElements(driver);
74
- //
75
- // verify(driver).findElementByXPath(".//*[@name = 'cheese']");
76
- // verify(driver).findElementsByXPath(".//*[@name = 'peas']");
77
- // verifyNoMoreInteractions(driver);
78
- // }
79
-
80
- // @Test
81
- // public void fallsBackOnXPathIfContextDoesNotImplementFallsById() {
82
- // OnlyXPath driver = mock(OnlyXPath.class);
83
- //
84
- // By.id("foo").findElement(driver);
85
- // By.id("bar").findElements(driver);
86
- //
87
- // verify(driver).findElementByXPath(".//*[@id = 'foo']");
88
- // verify(driver).findElementsByXPath(".//*[@id = 'bar']");
89
- // verifyNoMoreInteractions(driver);
90
- // }
91
68
92
69
@ Test
93
70
public void doesNotUseXPathIfContextFindsById () {
@@ -113,18 +90,6 @@ public void searchesByTagNameIfSupported() {
113
90
verifyNoMoreInteractions (context );
114
91
}
115
92
116
- // @Test
117
- // public void searchesByXPathIfCannotFindByTagName() {
118
- // OnlyXPath context = mock(OnlyXPath.class);
119
- //
120
- // By.tagName("foo").findElement(context);
121
- // By.tagName("bar").findElements(context);
122
- //
123
- // verify(context).findElementByXPath(".//foo");
124
- // verify(context).findElementsByXPath(".//bar");
125
- // verifyNoMoreInteractions(context);
126
- // }
127
-
128
93
@ Test
129
94
public void searchesByClassNameIfSupported () {
130
95
AllDriver context = mock (AllDriver .class );
@@ -137,20 +102,6 @@ public void searchesByClassNameIfSupported() {
137
102
verifyNoMoreInteractions (context );
138
103
}
139
104
140
- // @Test
141
- // public void searchesByXPathIfFindingByClassNameNotSupported() {
142
- // OnlyXPath context = mock(OnlyXPath.class);
143
- //
144
- // By.className("foo").findElement(context);
145
- // By.className("bar").findElements(context);
146
- //
147
- // verify(context).findElementByXPath(
148
- // ".//*[contains(concat(' ',normalize-space(@class),' '),' foo ')]");
149
- // verify(context).findElementsByXPath(
150
- // ".//*[contains(concat(' ',normalize-space(@class),' '),' bar ')]");
151
- // verifyNoMoreInteractions(context);
152
- // }
153
-
154
105
@ Test
155
106
public void innerClassesArePublicSoThatTheyCanBeReusedElsewhere () {
156
107
assertThat (new ByXPath ("a" ).toString ()).isEqualTo ("By.xpath: a" );
0 commit comments