What I did ??
I tried to record the scenario. While recording OATS recorded all the text filed with setText() method. Script looked cool.
While playing back,It did fill up the form but application was throwing error. It was saying that all fields were mandatory and user needed to fill it.
I noticed there was a ajax call which was sensing the key press event and trying to read the record on focus change.So manually when I tried to reproduce the case,application was behaving correctly. I changed the setText() method to keyPress() method and instead of clicking on the next field. I pressed TAB key. It worked!!!!.
- I general form fill up, When we click on submit button,all text filed data go to server. In this case we can use setText()
- There should not be any space in data inside keyPress() method. Like keyPress(“Test1234”) is valid but keyPress(“Test 1234”) is Invalid
- setText does a copy paste operation. So in such places where copy paste is prohibited we must use keyPress.