@@ -399,7 +399,7 @@ public void waitingForVisibilityOfThrowsStaleElementReferenceExceptionWhenElemen
399399 @ Test
400400 public void waitingForTextToBePresentInElementLocatedReturnsElement () {
401401 String testSelector = "testSelector" ;
402- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
402+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
403403 when (mockElement .getText ()).thenReturn ("testText" );
404404
405405 assertTrue (
@@ -409,7 +409,7 @@ public void waitingForTextToBePresentInElementLocatedReturnsElement() {
409409 @ Test
410410 public void waitingForTextToBePresentInElementLocatedReturnsElementWhenTextContainsSaidText () {
411411 String testSelector = "testSelector" ;
412- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
412+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
413413 when (mockElement .getText ()).thenReturn ("testText" );
414414
415415 assertTrue (wait .until (textToBePresentInElementLocated (By .cssSelector (testSelector ), "test" )));
@@ -420,7 +420,7 @@ public void waitingForHtmlAttributeToBeEqualForElementLocatedReturnsTrueWhenAttr
420420 String testSelector = "testSelector" ;
421421 String attributeName = "attributeName" ;
422422 String attributeValue = "attributeValue" ;
423- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
423+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
424424 when (mockElement .getAttribute (attributeName )).thenReturn (attributeValue );
425425 when (mockElement .getCssValue (attributeName )).thenReturn ("" );
426426
@@ -434,7 +434,7 @@ public void waitingForCssAttributeToBeEqualForElementLocatedReturnsTrueWhenAttri
434434 String testSelector = "testSelector" ;
435435 String attributeName = "attributeName" ;
436436 String attributeValue = "attributeValue" ;
437- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
437+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
438438 when (mockElement .getAttribute (attributeName )).thenReturn ("" );
439439 when (mockElement .getCssValue (attributeName )).thenReturn (attributeValue );
440440
@@ -447,7 +447,7 @@ public void waitingForCssAttributeToBeEqualForElementLocatedReturnsTrueWhenAttri
447447 public void waitingForCssAttributeToBeEqualForElementLocatedThrowsTimeoutExceptionWhenAttributeIsNotEqual () {
448448 String testSelector = "testSelector" ;
449449 String attributeName = "attributeName" ;
450- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
450+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
451451 when (mockElement .getAttribute (attributeName )).thenReturn ("" );
452452 when (mockElement .getCssValue (attributeName )).thenReturn ("" );
453453
@@ -490,7 +490,7 @@ public void waitingForHtmlAttributeToBeEqualForElementLocatedReturnsTrueWhenAttr
490490 String testSelector = "testSelector" ;
491491 String attributeName = "attributeName" ;
492492 String attributeValue = "test attributeValue test" ;
493- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
493+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
494494 when (mockElement .getAttribute (attributeName )).thenReturn (attributeValue );
495495 when (mockElement .getCssValue (attributeName )).thenReturn ("" );
496496
@@ -503,7 +503,7 @@ public void waitingForCssAttributeToBeEqualForElementLocatedReturnsTrueWhenAttri
503503 String testSelector = "testSelector" ;
504504 String attributeName = "attributeName" ;
505505 String attributeValue = "test attributeValue test" ;
506- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
506+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
507507 when (mockElement .getAttribute (attributeName )).thenReturn ("" );
508508 when (mockElement .getCssValue (attributeName )).thenReturn (attributeValue );
509509
@@ -557,7 +557,7 @@ public void waitingForCssAttributeToBeEqualForWebElementThrowsTimeoutExceptionWh
557557 public void waitingForTextToBeEqualForElementLocatedReturnsTrueWhenTextIsEqualToSaidText () {
558558 String testSelector = "testSelector" ;
559559 String testText = "test text" ;
560- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
560+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
561561 when (mockElement .getText ()).thenReturn (testText );
562562
563563 assertTrue (
@@ -685,7 +685,7 @@ public void waitingForAllExpectedConditionsToHavePositiveResultWhenAllPositive()
685685 @ Test
686686 public void waitingForTextMatchingPatternWhenTextExists () {
687687 String testSelector = "testSelector" ;
688- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
688+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
689689 when (mockElement .getText ()).thenReturn ("123" );
690690 assertTrue (wait .until (textMatches (By .cssSelector (testSelector ), Pattern .compile ("\\ d" ))));
691691 }
@@ -749,8 +749,7 @@ public void waitingForSpecificNumberOfElementsWhenNumberIsLess() {
749749 @ Test
750750 public void waitingForVisibilityOfNestedElementWhenElementIsVisible () {
751751 String testSelector = "testSelector" ;
752- when (mockElement .findElements (By .cssSelector (testSelector )))
753- .thenReturn (Arrays .asList (mockNestedElement ));
752+ when (mockElement .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays .asList (mockNestedElement ));
754753 when (mockElement .findElement (By .cssSelector (testSelector ))).thenReturn (mockNestedElement );
755754 when (mockNestedElement .isDisplayed ()).thenReturn (true );
756755 wait .until (visibilityOfNestedElementsLocatedBy (mockElement , By .cssSelector (testSelector )));
@@ -815,7 +814,7 @@ public void waitingForAllElementsInvisibilityWhenElementsAreVisible() {
815814 @ Test (expected = TimeoutException .class )
816815 public void waitingForTextToBePresentInElementLocatedThrowsTimeoutExceptionWhenTextNotPresent () {
817816 String testSelector = "testSelector" ;
818- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
817+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
819818 when (mockElement .getText ()).thenReturn ("testText" );
820819
821820 wait .until (textToBePresentInElementLocated (By .cssSelector (testSelector ), "failText" ));
@@ -824,7 +823,7 @@ public void waitingForTextToBePresentInElementLocatedThrowsTimeoutExceptionWhenT
824823 @ Test (expected = TimeoutException .class )
825824 public void waitingForTextToBePresentInElementLocatedThrowsTimeoutExceptionWhenElementIsStale () {
826825 String testSelector = "testSelector" ;
827- when (mockDriver .findElement (By .cssSelector (testSelector ))).thenReturn (mockElement );
826+ when (mockDriver .findElements (By .cssSelector (testSelector ))).thenReturn (Arrays . asList ( mockElement ) );
828827 when (mockElement .getText ()).thenThrow (new StaleElementReferenceException ("Stale element" ));
829828
830829 wait .until (textToBePresentInElementLocated (By .cssSelector (testSelector ), "testText" ));
0 commit comments