Ask a Question

Keyword Test not working the second time

SOLVED
klabbe
Occasional Contributor

Keyword Test not working the second time

Hello,

 

The application I am testing is a web application. I have a Keyword Test that runs successfully the first time but the second time it is always in error. Basically what my test does:

 

1- Click on the input text field
2- Do a "Ctrl + a"
3- Make a "Delete"
4- Enter new text

 

What I seem to notice is that the click on my field no longer works after the first time. So the "Ctrl + a" and all the rest either.

 

What I have tried to try to fix the problem:

 

1- I validate if my field exists and it returns True
2- I put some "Delay" before each operation but that doesn't change anything

3- I configured "auto-wait" property on operations and that doesn't change anything
4- Add an operation to put the focus on my field before the clic
5- I tried to put several "Click" operation in a row and it doesn't work either

 

I'm really out of ideas.

 

Help please!

 

Thank you.

 

Katherine

6 REPLIES 6
Marsha_R
Champion Level 2

I would try recording a test that performs these steps two or three times in a row, then see what code TestComplete generates for you.  There may be a clue in that generated code. 

tphillips
Frequent Contributor

Can you share what the error message is?


--------------------
Senior SQA Automation Engineer
klabbe
Occasional Contributor

@tphillips 

Hi,

 

I have a checkpoint that compares (after the save), the value in the field after the change with the value passed by a parameter and it failed because the change has not been made. But there is no error on the "Click", or "Ctl + A" or "Delete". When I run it, I can see that nothing is happening on the screen.

 

The "True" value that you see on the second line is the check that I'm doing to verify that the item exists.

 

klabbe_0-1641562891224.png

 

klabbe_1-1641563119516.png

 

klabbe
Occasional Contributor

Hi @Marsha_R ,

 

I've tried 3 different recordings and the they all have different results !!!

 

The recording is very slow since yesterday. I've tried closing everything and rebooting my computer but it's still slow.

 

1- The first recording, has recorded the "Click" and the "Ctrl + a" operations but not the "[Del]" one.

 

2- The second recording has just recorded the Click operation. Not the "Ctrl + a" and not the "[Del]" operations.

 

3- The third recording has recorded a "Click" and a "SetText" operations. No "Ctrl + a" and no "[Del]" operations.

 

Usually, I don't use anymore the "SetText" operation because it's not available most of the time even on items that are exactly the same type. I search the web regarding this and I read that you should use the "Keys" operation that is safer.

 

Thanks !

 

Katherine

klabbe
Occasional Contributor

@Marsha_R 

@tphillips 

 

I think I have found my problem. I thought I didn't need the "Navigate" operation at the start of a Keyword Test, if my browser was already open to the desired page. So I removed it from my test if my functionality had several Keyword Tests that I ran successively. Until now it was working. But I see that when I run the same test 2 times in a row, the second time doesn't work if I don't have the "Navigate" operation.

 

I'm a new user of TestComplete. It won't be my last mistake 😋

 

Thanks for your responses !

 

klabbe_0-1641567912829.png

 

Marsha_R
Champion Level 2

Yay, glad you figured it out!

 

Yes, Navigate turns out to be kind of like Set Focus.  Better to have it there just in case.

 

You're right about using Keys, although occasionally I have run into a spot where Set Text worked out better.

 

We will be here for more questions, any time!

 

 

cancel
Showing results for 
Search instead for 
Did you mean: