@@ -184,7 +184,7 @@ public String toString() {
184184 * @param locator used to find the element
185185 * @return the WebElement once it is located
186186 */
187- public static ExpectedCondition <@ Nullable WebElement > presenceOfElementLocated (final By locator ) {
187+ public static ExpectedCondition <WebElement > presenceOfElementLocated (final By locator ) {
188188 return new ExpectedCondition <>() {
189189 @ Override
190190 @ Nullable
@@ -245,10 +245,10 @@ public String toString() {
245245 * @param locator used to find the element
246246 * @return the list of WebElements once they are located
247247 */
248- public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfAllElementsLocatedBy (
248+ public static ExpectedCondition <List <WebElement >> visibilityOfAllElementsLocatedBy (
249249 final By locator ) {
250- return new ExpectedCondition <@ Nullable List < WebElement > >() {
251- private int indexOfInvisibleElement ;
250+ return new ExpectedCondition <>() {
251+ private int indexOfInvisibleElement = - 1 ;
252252 private @ Nullable WebElement invisibleElement ;
253253
254254 @ Override
@@ -289,7 +289,7 @@ public String toString() {
289289 * @param elements list of WebElements
290290 * @return the list of WebElements once they are located
291291 */
292- public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfAllElements (
292+ public static ExpectedCondition <List <WebElement >> visibilityOfAllElements (
293293 final WebElement ... elements ) {
294294 return visibilityOfAllElements (List .of (elements ));
295295 }
@@ -302,10 +302,10 @@ public String toString() {
302302 * @param elements list of WebElements
303303 * @return the list of WebElements once they are located
304304 */
305- public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfAllElements (
305+ public static ExpectedCondition <List <WebElement >> visibilityOfAllElements (
306306 final List <WebElement > elements ) {
307- return new ExpectedCondition <@ Nullable List < WebElement > >() {
308- private int indexOfInvisibleElement ;
307+ return new ExpectedCondition <>() {
308+ private int indexOfInvisibleElement = - 1 ;
309309 private @ Nullable WebElement invisibleElement ;
310310
311311 @ Override
@@ -344,8 +344,8 @@ public String toString() {
344344 * @param element the WebElement
345345 * @return the (same) WebElement once it is visible
346346 */
347- public static ExpectedCondition <@ Nullable WebElement > visibilityOf (final WebElement element ) {
348- return new ExpectedCondition <@ Nullable WebElement >() {
347+ public static ExpectedCondition <WebElement > visibilityOf (final WebElement element ) {
348+ return new ExpectedCondition <>() {
349349 @ Override
350350 public @ Nullable WebElement apply (WebDriver driver ) {
351351 return elementIfVisible (element );
@@ -371,9 +371,9 @@ public String toString() {
371371 * @param locator used to find the element
372372 * @return the list of WebElements once they are located
373373 */
374- public static ExpectedCondition <@ Nullable List <WebElement >> presenceOfAllElementsLocatedBy (
374+ public static ExpectedCondition <List <WebElement >> presenceOfAllElementsLocatedBy (
375375 final By locator ) {
376- return new ExpectedCondition <@ Nullable List < WebElement > >() {
376+ return new ExpectedCondition <>() {
377377 @ Override
378378 public @ Nullable List <WebElement > apply (WebDriver driver ) {
379379 List <WebElement > elements = driver .findElements (locator );
@@ -594,9 +594,8 @@ public String toString() {
594594 * @param locator used to find the frame
595595 * @return WebDriver instance after frame has been switched
596596 */
597- public static ExpectedCondition <@ Nullable WebDriver > frameToBeAvailableAndSwitchToIt (
598- final By locator ) {
599- return new ExpectedCondition <@ Nullable WebDriver >() {
597+ public static ExpectedCondition <WebDriver > frameToBeAvailableAndSwitchToIt (final By locator ) {
598+ return new ExpectedCondition <>() {
600599 private @ Nullable NotFoundException error ;
601600
602601 @ Override
@@ -658,9 +657,9 @@ public String toString() {
658657 * @param frame used to find the frame (web element)
659658 * @return WebDriver instance after frame has been switched
660659 */
661- public static ExpectedCondition <@ Nullable WebDriver > frameToBeAvailableAndSwitchToIt (
660+ public static ExpectedCondition <WebDriver > frameToBeAvailableAndSwitchToIt (
662661 final WebElement frame ) {
663- return new ExpectedCondition <@ Nullable WebDriver >() {
662+ return new ExpectedCondition <>() {
664663 private @ Nullable NoSuchFrameException error ;
665664
666665 @ Override
@@ -849,8 +848,8 @@ public String toString() {
849848 * @param <T> return type of the condition provided
850849 * @return the result of the provided condition
851850 */
852- public static <T > ExpectedCondition <@ Nullable T > refreshed (final ExpectedCondition <T > condition ) {
853- return new ExpectedCondition <@ Nullable T >() {
851+ public static <T > ExpectedCondition <T > refreshed (final ExpectedCondition <T > condition ) {
852+ return new ExpectedCondition <>() {
854853 @ Override
855854 public @ Nullable T apply (WebDriver driver ) {
856855 try {
@@ -933,8 +932,8 @@ public String toString() {
933932 };
934933 }
935934
936- public static ExpectedCondition <@ Nullable Alert > alertIsPresent () {
937- return new ExpectedCondition <@ Nullable Alert >() {
935+ public static ExpectedCondition <Alert > alertIsPresent () {
936+ return new ExpectedCondition <>() {
938937 @ Override
939938 public @ Nullable Alert apply (WebDriver driver ) {
940939 try {
@@ -953,7 +952,7 @@ public String toString() {
953952
954953 public static ExpectedCondition <Boolean > numberOfWindowsToBe (final int expectedNumberOfWindows ) {
955954 return new ExpectedCondition <>() {
956- private int actualNumberOfWindows ;
955+ private int actualNumberOfWindows = - 1 ;
957956 private @ Nullable WebDriverException error ;
958957
959958 @ Override
@@ -1134,10 +1133,10 @@ public String toString() {
11341133 * @param expectedNumber used to define minimum number of elements
11351134 * @return Boolean true when size of elements list is more than defined
11361135 */
1137- public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBeMoreThan (
1136+ public static ExpectedCondition <List <WebElement >> numberOfElementsToBeMoreThan (
11381137 final By locator , final Integer expectedNumber ) {
1139- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1140- private Integer actualNumber = 0 ;
1138+ return new ExpectedCondition <>() {
1139+ private Integer actualNumber = - 1 ;
11411140
11421141 @ Override
11431142 public @ Nullable List <WebElement > apply (WebDriver webDriver ) {
@@ -1163,10 +1162,10 @@ public String toString() {
11631162 * @param number used to define maximum number of elements
11641163 * @return Boolean true when size of elements list is less than defined
11651164 */
1166- public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBeLessThan (
1165+ public static ExpectedCondition <List <WebElement >> numberOfElementsToBeLessThan (
11671166 final By locator , final Integer number ) {
1168- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1169- private Integer currentNumber = 0 ;
1167+ return new ExpectedCondition <>() {
1168+ private Integer currentNumber = - 1 ;
11701169
11711170 @ Override
11721171 public @ Nullable List <WebElement > apply (WebDriver webDriver ) {
@@ -1191,9 +1190,9 @@ public String toString() {
11911190 * @param expectedNumberOfElements used to define number of elements
11921191 * @return Boolean true when size of elements list is equal to defined
11931192 */
1194- public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBe (
1193+ public static ExpectedCondition <List <WebElement >> numberOfElementsToBe (
11951194 final By locator , final Integer expectedNumberOfElements ) {
1196- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1195+ return new ExpectedCondition <>() {
11971196 private Integer actualNumberOfElements = -1 ;
11981197
11991198 @ Override
@@ -1412,9 +1411,9 @@ private static Optional<String> getAttributeOrCssValue(WebElement element, Strin
14121411 * @param childLocator used to find the child elements.
14131412 * @return visible nested element
14141413 */
1415- public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfNestedElementsLocatedBy (
1414+ public static ExpectedCondition <List <WebElement >> visibilityOfNestedElementsLocatedBy (
14161415 final By parent , final By childLocator ) {
1417- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1416+ return new ExpectedCondition <>() {
14181417 private int indexOfInvisibleElement = -1 ;
14191418 private @ Nullable WebElement invisibleChild ;
14201419
@@ -1463,9 +1462,9 @@ public String toString() {
14631462 * By.xpath("./tr/td")}.
14641463 * @return visible sub-element
14651464 */
1466- public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfNestedElementsLocatedBy (
1465+ public static ExpectedCondition <List <WebElement >> visibilityOfNestedElementsLocatedBy (
14671466 final WebElement element , final By childLocator ) {
1468- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1467+ return new ExpectedCondition <>() {
14691468 private int indexOfInvisibleElement = -1 ;
14701469 private @ Nullable WebElement invisibleChild ;
14711470
@@ -1513,7 +1512,7 @@ public String toString() {
15131512 * By.xpath("./tr/td")}.
15141513 * @return sub-element
15151514 */
1516- public static ExpectedCondition <@ Nullable WebElement > presenceOfNestedElementLocatedBy (
1515+ public static ExpectedCondition <WebElement > presenceOfNestedElementLocatedBy (
15171516 final By locator , final By childLocator ) {
15181517 return new ExpectedCondition <>() {
15191518
@@ -1543,7 +1542,7 @@ public String toString() {
15431542 * By.xpath("./tr/td")}.
15441543 * @return sub-element
15451544 */
1546- public static ExpectedCondition <@ Nullable WebElement > presenceOfNestedElementLocatedBy (
1545+ public static ExpectedCondition <WebElement > presenceOfNestedElementLocatedBy (
15471546 final WebElement element , final By childLocator ) {
15481547
15491548 return new ExpectedCondition <>() {
@@ -1573,9 +1572,9 @@ public String toString() {
15731572 * By.xpath("./tr/td")}.
15741573 * @return sub-element
15751574 */
1576- public static ExpectedCondition <@ Nullable List <WebElement >> presenceOfNestedElementsLocatedBy (
1575+ public static ExpectedCondition <List <WebElement >> presenceOfNestedElementsLocatedBy (
15771576 final By parent , final By childLocator ) {
1578- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1577+ return new ExpectedCondition <>() {
15791578
15801579 @ Override
15811580 public @ Nullable List <WebElement > apply (WebDriver driver ) {
@@ -1610,7 +1609,7 @@ public static ExpectedCondition<Boolean> invisibilityOfAllElements(final WebElem
16101609 public static ExpectedCondition <Boolean > invisibilityOfAllElements (
16111610 final List <WebElement > elements ) {
16121611 return new ExpectedCondition <>() {
1613- private int indexOfVisibleElement ;
1612+ private int indexOfVisibleElement = - 1 ;
16141613 private @ Nullable WebElement visibleElement ;
16151614
16161615 @ Override
@@ -1807,8 +1806,8 @@ public String toString() {
18071806 * @param javaScript as executable js line
18081807 * @return object once JavaScript executes without errors
18091808 */
1810- public static ExpectedCondition <@ Nullable Object > jsReturnsValue (final String javaScript ) {
1811- return new ExpectedCondition <@ Nullable Object >() {
1809+ public static ExpectedCondition <Object > jsReturnsValue (final String javaScript ) {
1810+ return new ExpectedCondition <>() {
18121811 private @ Nullable WebDriverException error ;
18131812
18141813 @ Override
0 commit comments