mercredi 2 janvier 2019

How to get int from web element text?

I was trying to perform operations with integer. below I am reading one web element and performing simple addition operation with one int variable. one has number and one has web element text. my code is not working. below is my code details. please help me. below it supposed to add int input Day and in number from a web element.

{
int inputDay = 10;
String inputMonth = "March";
int inputYears = 2019;

driver.get(url);
List<WebElement> calendarAvailableDate = new ArrayList<>();
calendarAvailableDate = driver.findElements(By.className(" locator"));      

    for(WebElement a:calendarAvailableDate) {
        inputDay=inputDay+Integer.parseInt(a.getText());
        System.out.println(inputDay);
        }
}

5=2+3; Where 2 is integer and 3 is converted from web element

Aucun commentaire:

Enregistrer un commentaire