@@ -247,8 +247,8 @@ public String toString() {
247247 */
248248 public static ExpectedCondition <@ Nullable 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
@@ -304,8 +304,8 @@ public String toString() {
304304 */
305305 public static ExpectedCondition <@ Nullable 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
@@ -345,7 +345,7 @@ public String toString() {
345345 * @return the (same) WebElement once it is visible
346346 */
347347 public static ExpectedCondition <@ Nullable WebElement > visibilityOf (final WebElement element ) {
348- return new ExpectedCondition <@ Nullable WebElement >() {
348+ return new ExpectedCondition <>() {
349349 @ Override
350350 public @ Nullable WebElement apply (WebDriver driver ) {
351351 return elementIfVisible (element );
@@ -373,7 +373,7 @@ public String toString() {
373373 */
374374 public static ExpectedCondition <@ Nullable 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 );
@@ -596,7 +596,7 @@ public String toString() {
596596 */
597597 public static ExpectedCondition <@ Nullable WebDriver > frameToBeAvailableAndSwitchToIt (
598598 final By locator ) {
599- return new ExpectedCondition <@ Nullable WebDriver >() {
599+ return new ExpectedCondition <>() {
600600 private @ Nullable NotFoundException error ;
601601
602602 @ Override
@@ -660,7 +660,7 @@ public String toString() {
660660 */
661661 public static ExpectedCondition <@ Nullable WebDriver > frameToBeAvailableAndSwitchToIt (
662662 final WebElement frame ) {
663- return new ExpectedCondition <@ Nullable WebDriver >() {
663+ return new ExpectedCondition <>() {
664664 private @ Nullable NoSuchFrameException error ;
665665
666666 @ Override
@@ -850,7 +850,7 @@ public String toString() {
850850 * @return the result of the provided condition
851851 */
852852 public static <T > ExpectedCondition <@ Nullable T > refreshed (final ExpectedCondition <T > condition ) {
853- return new ExpectedCondition <@ Nullable T >() {
853+ return new ExpectedCondition <>() {
854854 @ Override
855855 public @ Nullable T apply (WebDriver driver ) {
856856 try {
@@ -934,7 +934,7 @@ public String toString() {
934934 }
935935
936936 public static ExpectedCondition <@ Nullable Alert > alertIsPresent () {
937- return new ExpectedCondition <@ Nullable Alert >() {
937+ return new ExpectedCondition <>() {
938938 @ Override
939939 public @ Nullable Alert apply (WebDriver driver ) {
940940 try {
@@ -953,7 +953,7 @@ public String toString() {
953953
954954 public static ExpectedCondition <Boolean > numberOfWindowsToBe (final int expectedNumberOfWindows ) {
955955 return new ExpectedCondition <>() {
956- private int actualNumberOfWindows ;
956+ private int actualNumberOfWindows = - 1 ;
957957 private @ Nullable WebDriverException error ;
958958
959959 @ Override
@@ -1136,7 +1136,7 @@ public String toString() {
11361136 */
11371137 public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBeMoreThan (
11381138 final By locator , final Integer expectedNumber ) {
1139- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1139+ return new ExpectedCondition <>() {
11401140 private Integer actualNumber = 0 ;
11411141
11421142 @ Override
@@ -1165,7 +1165,7 @@ public String toString() {
11651165 */
11661166 public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBeLessThan (
11671167 final By locator , final Integer number ) {
1168- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1168+ return new ExpectedCondition <>() {
11691169 private Integer currentNumber = 0 ;
11701170
11711171 @ Override
@@ -1193,7 +1193,7 @@ public String toString() {
11931193 */
11941194 public static ExpectedCondition <@ Nullable List <WebElement >> numberOfElementsToBe (
11951195 final By locator , final Integer expectedNumberOfElements ) {
1196- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1196+ return new ExpectedCondition <>() {
11971197 private Integer actualNumberOfElements = -1 ;
11981198
11991199 @ Override
@@ -1414,7 +1414,7 @@ private static Optional<String> getAttributeOrCssValue(WebElement element, Strin
14141414 */
14151415 public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfNestedElementsLocatedBy (
14161416 final By parent , final By childLocator ) {
1417- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1417+ return new ExpectedCondition <>() {
14181418 private int indexOfInvisibleElement = -1 ;
14191419 private @ Nullable WebElement invisibleChild ;
14201420
@@ -1465,7 +1465,7 @@ public String toString() {
14651465 */
14661466 public static ExpectedCondition <@ Nullable List <WebElement >> visibilityOfNestedElementsLocatedBy (
14671467 final WebElement element , final By childLocator ) {
1468- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1468+ return new ExpectedCondition <>() {
14691469 private int indexOfInvisibleElement = -1 ;
14701470 private @ Nullable WebElement invisibleChild ;
14711471
@@ -1575,7 +1575,7 @@ public String toString() {
15751575 */
15761576 public static ExpectedCondition <@ Nullable List <WebElement >> presenceOfNestedElementsLocatedBy (
15771577 final By parent , final By childLocator ) {
1578- return new ExpectedCondition <@ Nullable List < WebElement > >() {
1578+ return new ExpectedCondition <>() {
15791579
15801580 @ Override
15811581 public @ Nullable List <WebElement > apply (WebDriver driver ) {
@@ -1610,7 +1610,7 @@ public static ExpectedCondition<Boolean> invisibilityOfAllElements(final WebElem
16101610 public static ExpectedCondition <Boolean > invisibilityOfAllElements (
16111611 final List <WebElement > elements ) {
16121612 return new ExpectedCondition <>() {
1613- private int indexOfVisibleElement ;
1613+ private int indexOfVisibleElement = - 1 ;
16141614 private @ Nullable WebElement visibleElement ;
16151615
16161616 @ Override
@@ -1808,7 +1808,7 @@ public String toString() {
18081808 * @return object once JavaScript executes without errors
18091809 */
18101810 public static ExpectedCondition <@ Nullable Object > jsReturnsValue (final String javaScript ) {
1811- return new ExpectedCondition <@ Nullable Object >() {
1811+ return new ExpectedCondition <>() {
18121812 private @ Nullable WebDriverException error ;
18131813
18141814 @ Override
0 commit comments