I want to add today’s count. I am new to selenium, and am not getting how to add using selenium. Can anyone suggest a solution?
This is my code:
package testpk;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.awt.List;
import org.openqa.selenium.*;
public class Form {
public static void main(String[] args) throws InterruptedException {
// declaration and instantiation of objects/variables
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://beta-app.1bridge.in/#/auth/login");
Thread.sleep(6000);
driver.findElement(By.xpath("//input[@type='text']")).sendKeys("RB0764",Keys.ENTER);
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@type='password']")).sendKeys("kanna123",Keys.ENTER);
Thread.sleep(7000);
driver.findElement(By.xpath("//*[@data-id='dashboard']")).click();
Thread.sleep(5000);
WebElement table = driver.findElement(By.xpath("//*[@id="pcoded"]/div[2]/div/div/div/div/div/div/app-default/div/app-modal-basic/div/div/div/div/div/div/table/tbody/tr[1]/td[1]/p"));
List listOfRows = (List) table.findElements(By.tagName("tr"));
System.out.println("Rows: "+listOfRows.size());
//List<WebElement> listOfCols = listOfRows.get(0).findElements(By.tagName("td")); //If first row is normal row
List<WebElement> listOfCols = ((WebDriver) listOfRows).get(0).findElements(By.tagName("th")); //If first row is header row
System.out.println("Columns: "+listOfCols.size());
}
}
Source: Read More