private void addViewsToList ( List < WebElement > allWebElements , List < WebElement > webElementsOnScreen ) { int [ ] xyViewFromSet = new int [ 2 ] ; int [ ] xyViewFromScreen = new int [ 2 ] ; for ( WebElement textFromScreen : webElementsOnScreen ) { boolean foundView = false ; textFromScreen . getLocationOnScreen ( xyViewFromScreen ) ; for ( WebElement textFromList : allWebElements ) { textFromList . getLocationOnScreen ( xyViewFromSet ) ; if ( textFromScreen . getText ( ) . equals ( textFromList . getText ( ) ) && xyViewFromScreen [ 0 ] == xyViewFromSet [ 0 ] && xyViewFromScreen [ 1 ] == xyViewFromSet [ 1 ] ) { foundView = true ; } } if ( ! foundView ) { allWebElements . add ( textFromScreen ) ; } } }
Adds views to a given list .