enter image description hereenter image description here

I am automating windows application using tool using java language. I am selecting a respective player. I am able to selecting player. But in my second table contain down option is there, so my first selection player name is that in the down option, so I can’t able to down and select that player.
Firstly, I took the first table and fetch all the list of players in that tableand put into one list array and same way fetch the list of player from second table put into second list array and I add both player names into one list array. and read the names from excel. I am able to read the player in the GUI and select, but the real issue is with scroll down..

Here my code first check the player in the list, my first player is not in the gui , that i need to scroll down , then only it can able to select that name..

public  void away_team_lineups_excel()
           try {
               WebElement away_players_list1 = driver.findElementById("lsvAwayTeamHitters1");
               WebElement away_players_list2 = driver.findElement(By.id("lsvAwayTeamHitters2"));

               List<WebElement> away_team_players_lineups1 = away_players_list1.findElements(By.xpath("./*[contains(@LocalizedControlType, 'item')]"));
               List<WebElement> away_team_players_lineups2 = away_players_list2.findElements(By.xpath("./*[contains(@LocalizedControlType, 'item')]"));

               List<String> away_players1 = new ArrayList<String>();
               for(int i=0;i<away_team_players_lineups1.size();i++)
               List<WebElement> away_team_players_names = away_team_players_lineups1.get(i).findElements(By.xpath("./*[contains(@LocalizedControlType, 'text')]"));

                   for(int j=3;j<away_team_players_names.size();j++)
                       String celtext = away_team_players_names.get(j).getAttribute("Name");




               List<String> away_players2 = new ArrayList<String>();
               for(int j=0;j<away_team_players_lineups2.size();j++)
               List<WebElement> away_team_players_names2 = away_team_players_lineups2.get(j).findElements(By.xpath("./*[contains(@LocalizedControlType, 'text')]"));

                   for(int k=3;k<away_team_players_names2.size();k++)
                       String celtext = away_team_players_names2.get(k).getAttribute("Name");



               List<String> away_players3 = new ArrayList<String>(); 

               File f= new File("Player_names.xlsx");
            FileInputStream fs= new FileInputStream(f);
            XSSFWorkbook wb= new XSSFWorkbook(fs); 
            XSSFSheet bb_players=  wb.getSheet("Sheet1");
            int rowcount= bb_players.getLastRowNum();

                     Actions action= new Actions(driver);
                   for(int i=1; i<=rowcount; i++)                                
                        String player = bb_players.getRow(i).getCell(0).getStringCellValue();
                        String position = bb_players.getRow(i).getCell(1).getStringCellValue();

                                  for(int j=0;j<away_players3.size();j++) {

                                  String away_total_players= away_players3.get(j);


                                boolean exist=driver.findElementByName(player).isDisplayed();

                                if(exist) {
                                     WebElement scroll = away_players_list2.findElement(By.name("Back by large amount"));


                                 WebElement line_up1 = driver.findElementByName(player);                                    

                                 else if(!exist) {
                                     WebElement scroll = away_players_list2.findElement(By.name("Forward by large amount"));                                                                       
                                     WebElement line_up2 = driver.findElementByName(player);                                    


                                List<String> away_plyers_positions = new ArrayList<String>();

                                WebElement away_players_pos = driver.findElementById("PlayerPositions");

                                List<WebElement> player_pos = away_players_pos.findElements(By.xpath("./*[contains(@ControlType,'Button')]"));

                                     for(int a=0; a<player_pos.size(); a++)
                                       String aw_player_pos =  away_plyers_positions.get(a);


           catch (Exception e) {

now scroll click is working fine.. anybody please check my code that i did correct or not ?

My application working for selection player is first select a player and then select a position
Here I’m getting error is its selecting only three player after that getting element not found exception

Source link https://sqa.stackexchange.com/questions/34090/winium-scroll-down


Please enter your comment!
Please enter your name here