I am trying to get the value displayed against the Total using the below code:
driver.get("https://www.cricbuzz.com/live-cricket-scorecard/20137/sl-vs-eng-4th-odi-england-tour-of-sri-lanka-2018");
String textextras = driver.findElement(By.cssSelector("div[class='cb-col cb-col-100 cb-ltst-wgt-hdr']")).findElement(By.cssSelector("div:nth-last-child(3) div:nth-child(2)")).getText();
System.out.println(textextras);
String textsum = driver.findElement(By.cssSelector("div[class='cb-col cb-col-100 cb-ltst-wgt-hdr']")).findElement(By.cssSelector("div:nth-last-child(2) div:nth-child(2)")).getText();
System.out.println(textsum);
Output:
19 Batsman R B 4s 6s SR
Can anyone please help me why it is not working for textsum, but it is working fine for textextras variable ?
Source: Read More