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 value which will throw error
  • I the text box and add valid value and click on confirm button
  • Then I see the answer provided in 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 certain period when the test is run then the clear works. But it is not reliable.



Source link https://sqa.stackexchange.com/questions/33259/clear-method--while--the-

LEAVE A REPLY

Please enter your comment!
Please enter your name here