Search code examples
javaseleniumjunitautomated-teststhucydides

thucydedes test to replicate a text area getting populated with text


I am writing a thusydides test to replicate a scenario where a text field gets values added same as someone is typing a paragraph in that text area.

my approach is to create a loop in the test case.

   @FindBy(id="my-description")
   private WebElement textArea;

   @Test
   public void my_test(){
       for(int i=0;i<10;i++){
         String value = $(textArea).getValue();
         value = value + description;
         $(textArea).type(value);
         //waitForsometime(200);
       }
    }

The issue is that the values get disappeared for each iteration before re appearing with the accumulated value. Any approach that I can achieve this?


Solution

  • $(textArea).type()
    

    will clear the field before entering any value. we have to use

    $(textArea).sendKeys()
    

    instead.