-2

I am fetching the value from excel and passed in my field.am using below code

    if (sh1.getRow(0).getCell(j).getStringCellValue().equals(reg_id)) {
        int k = 1;
        while (k <= sh1.getLastRowNum()) {
            try {
                //System.out.println(sh1.getRow(k).getCell(j).getStringCellValue());
                MethodCall.execution(sh1.getRow(k).getCell(j + 1).getStringCellValue(),
                sh1.getRow(k).getCell(j).getStringCellValue());        
                Thread.sleep(2000);
                } catch (Exception e) {
                 break;
                    }
                k++;
            }
    WebElement Maximum_Discount=Driver.dr.findElement(Organization_Settings_OSPF.Mobile_Number);
    Maximum_Discount.clear();
  Maximum_Discount.sendKeys(sh.getRow(1).getCell(7).getStringCellValue().toString());
 Thread.sleep(5000);

But it not pass the value.

  • String number = "10"; int result = Integer.parseInt(number); System.out.println(result); – Rahul Kant Jha Engg - CX Mar 1 '18 at 9:03
  • 1
    Do you get any error message? – Embedded Mar 1 '18 at 9:50
1

I cannot see where the error is happening, but, in Java, you transform a String into a Integer in two ways:

1 - Integer x = new Integer("565")

2 - int x = Integer.parseInt("565")

The first on returns the Integer object, and the second one return the primite value of type int.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.