I’m writing automation script for a page in which there is a text box. The scenario is as follows:
I click on the text box and enter a value which will throw error
I clear the text box and add valid value and click on confirm button
Then I see the answer provided in the text box as an answer bubble
I click on the edit button to change the answer bubble back into text box
I clear the text box and add new value
In the last step where I need to clear and add new value to the text box, what happens is that the text box is not cleared even when the code is there to clear it. In step 2 it does clear the text box.
public void enterElectricityReading(String electricReading) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.elementToBeClickable(electricityField));
electricityField.clear();
electricityField.sendKeys(electricReading);
}
Can someone help me to understand why does the clear code is not run and value is not cleared?
At a certain period when the test is run then the clear method works. But it is not reliable.
Like this:
Like Loading...