Skip to main content

For one of our automation we are using Set Text method to enter data into web page, we have noticed that Set text does not work if there a delay given between keystroke.

 

If we remove delay between key stroke then sometimes it works and sometime does not and when it is not working it is not throwing exception as well, due to this incorrect exceptions are being reported, has any one observed this behavior ?

 

or a behavior where AA methods like click/read text etc. not performing the job and not even reporting error ?

Hello @ishan mahajan​ 

Maybe you shouldnt delete the delay between keystrokes, but give it less like 2ms or something

if that doesnt work, Could you try using Recorder:Capture - left click to find where to text, and Simultane Keystrokes. afterwards.

 

But if Set Text can find the place where it should text, it must work if you give the correct delay time between keystrokes, just try to find the best delay


@ishan mahajan​  I've seen similar behaviour to this before where either a delay causes it to be entered incorrectly or without a delay it is sometimes missed completely.

 

You could put some "defensive" programming in place, where you set text on the input without a delay, which should work majority of the time, then immediately check the input value matches the value you are setting. If there is a mismatch, set the value again. If done in a loop you could then retry up to x tries to ensure it is putting it in. If it hits your retry limit, raise a custom exception.


Yeah i guess that is the only way, i wish if it could have thrown exception if it is unsuccessful to set text.


Hi @ishan mahajan​ 

would you try Recorder:Click, and simultane keystrokes : Ctrl + A since it has to be deleted first, and then simultane keystrokes: the text which u want to enter

you might put 50ms delay between simultane keystrokes.

and also a few ms for keystrokes : might be 2 ms, if that doesnt work, maybe 5ms and so on.


Hi Semih,

 

we observed that for UAT users Left click was not working, i don't know exact reason so we replaced left click with click.

 

Set text with Delay also first perform left click on that element and then enters the text hence it has to be deleted.


Reply