Selenium Web Driver를 사용하여 특정 필드에 값 (null
)이 있는지 확인할 수 있습니까?필드에 값이 없음을 확인하려면 어떻게합니까?
이것은 내가 지금까지 무엇을 가지고 :
WebDriverWait wait5 = new WebDriverWait(driver, 5);
wait5.until(ExpectedConditions.elementToBeClickable(By.name("chargeId")));
Selenium Web Driver를 사용하여 특정 필드에 값 (null
)이 있는지 확인할 수 있습니까?필드에 값이 없음을 확인하려면 어떻게합니까?
이것은 내가 지금까지 무엇을 가지고 :
WebDriverWait wait5 = new WebDriverWait(driver, 5);
wait5.until(ExpectedConditions.elementToBeClickable(By.name("chargeId")));
WebDriverWait wait5 = new WebDriverWait(driver, 5);
WebElement charge = wait5.until(ExpectedConditions.elementToBeClickable(By.name("chargeId")));
boolean noChargeIdPresent = charge.getText().isEmpty();
이 당신이 필드가 비어 있는지 여부를 알려줍니다.
WebDriverWait wait5 = new WebDriverWait(driver, 5);
wait5.until(ExpectedConditions.elementToBeClickable(By.name("chargeId")));
if(wait5.findElement(By.name("chargeId")).getText().length() == 0) {
// =========== DO WHAT YOU WANT IF EMPTY============
}
else {
//======== DO WHEN NOT EMPTY==================
}
코드는 완전히 다른 것을하고 있습니다. 요소가 * clickable *이 될 때까지 기다립니다. 확인할 필드는 무엇입니까? – xyz
'null' **은 값이없는 것과는 다릅니다 **. 그것은 어떤 요소입니까? 우리에게 HTML을 보여주세요. – Arran