I want to just print runs scored by all batsman during the cricket match in selenium using CSS selector. All rows have same classname and the runs are in 3rd row so I used CSS selector to select 3rd row only, but I am not able to print runs. Here is my code:
package SomeBasicAutomationPractice;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class tableGrid_Practice {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "G:\\AutomationPractice\\src\\drivers\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("http://www.cricbuzz.com/live-cricket-scorecard/18970/pak-vs-sl-2nd-t20i-pakistan-v-sri-lanka-in-uae-2017");
Thread.sleep(5000);
WebElement table=driver.findElement(By.cssSelector("div[class='cb-col cb-col-100 cb-ltst-wgt-hdr']"));
int count=table.findElements(By.cssSelector("div[classname='cb-col cb-col-100 cb-scrd-itms'] div:nth-child(3)")).size();
System.out.println(count);
for(int i=0;i<count;i++)
{
//table.findElements(By.cssSelector("div[classname='cb-col cb-col-100 cb-scrd-itms'] div:nth-child(3)")).get(i);
System.out.println(table.findElements(By.cssSelector("div[classname='cb-col cb-col-100 cb-scrd-itms'] div:nth-child(3)")).get(i));
}
}
}