代码优化2

来源:互联网 发布:软件科技成果鉴定证书 编辑:程序博客网 时间:2024/05/23 00:48

for (inti=0;i<lable.size();i++){

           if(lable.get(i).getText().contains(dQPlayerNumber)){

              if(i==0){

                  WebElement player = driver.findElement(By.cssSelector("tbody[id$='tbodyPlayerListForPlayerRoster']tr:first-child td:nth-child(3) font"));

                  Assert.assertTrue(player.getText().contains(message));

                  log.info("Playerinfo: " +player.getText());

                  Assert.assertEquals(player.getAttribute("color"),"red");

                  log.info("Assert DQplayer on Stats and Standing");

              }else{

                  WebElement player = driver.findElement(By.cssSelector("tbody[id$='tbodyPlayerListForPlayerRoster']tr:nth-child("+ (i+1) +") td:nth-child(3) font"));

                  Assert.assertTrue(player.getText().contains(message));

                  log.info("Playerinfo: " +player.getText());

                  Assert.assertEquals(player.getAttribute("color"),"red");

                  log.info("Assert DQplayer on Stats and Standing");

              }

           }

       }  




0 0
原创粉丝点击