Boa noite galera estou com o seguinte codigo
Double outrosValores = 0.0;
Double valorTotal = 0.0;
List<WebElement> webElements = webDriver.findElements(By.className(getProperty("FaturaPendentes")))
.get(0).findElements(By.tagName(getProperty("B")));
for (int i = 1; i < webElements.size(); i++) {
if (i != 3) {
outrosValores += Double.parseDouble(webElements.get(i).getText().replace(",", "."));
} else {
valorTotal = Double.parseDouble(webElements.get(i).getText().replace(",", "."));
}
}
debitoVO.setOutrosValores(String.format("%.2f", outrosValores));
debitoVO.setValorDebito(String.format("%.2f", valorTotal));
}
nesse codigo caso um numero venha maior que 999,99 funciona direitinho, porem caso venha maior ele da erro
Exception in thread "main" java.lang.NumberFormatException: For input string: "1.000,00"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at testes.teste.main(teste.java:16)
to testando com decimalFormat e numberFormat, mas n encontro o patterns certo para fazer a conversão para double