我試圖將字符串從webelement轉換爲整數。無法將字符串值從Web元素轉換爲雙倍
不過,我得到以下錯誤parseInt
public String getLoanAmount() {
return loanAmount.getText();
int i = Integer.parseInt(driver.findElement(By.id("00N28000001bbuD_ileinner"))).getText();
double d = i;
if ((d < 15000) || (d > 35000)) {
System.out.println("Error: Loan Amount should not be NULL and should be between 5000 to 35000 AUD.");
}
else {
System.out.println("Entered value in the Loan Amount field is within appropriate range.");
}
}
任何人都可以協助在這個問題上?首先這可能嗎?並且是實現它的正確步驟?
該錯誤信息是明確的:你試圖將字符串轉換成該整數,它不能完成,很可能是因爲字符串不是數字的表示。 –
@TimBiegeleisen你從哪裏得到這些信息? – shmosel