Typing a lot of text into a TextArea control

Ask general questions here.
User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Typing a lot of text into a TextArea control

Post by Aracknid » Wed Oct 16, 2013 4:40 pm

Hi,

We have a TextArea control, and we need to type a lot of text into it. The function I have deep down in my framework is doing a simple TextArea.Presskeys(strTheText), where strTheText is very very long.

It seems as though presskeys doesn't wait for the text to be entered into the control before it moves on to the next line of code, which in our case is a check to ensure the text was properly set. Obviously, for short text strings it was working fine but for long strings it fails.

We resolved the issue by putting a delay in. But I was wondering if this all made sense. Why doesn't presskeys wait unti it's done pressing all the keys before it moves one? Also, is there a better way to do this?

Thanks,

Aracknid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Typing a lot of text into a TextArea control

Post by Support Team » Thu Oct 17, 2013 3:07 pm

Hello,

I would like to reproduce your issue.
Is it possible to reproduce it with the simple Notepad editor?
How long is your text?
How long does it take it to enter it into the TextArea control?
Do you see this behavior if you set the Text attribute as well?

Thanks in advance.

Regards,
Markus (T)

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Typing a lot of text into a TextArea control

Post by Aracknid » Mon Oct 21, 2013 9:52 pm

Support Team wrote: Is it possible to reproduce it with the simple Notepad editor?
I have no idea. I'm not testing against notepad. Use Chrome and use presskeys to put the text into a Text Area control to reproduce my problem.
Support Team wrote: How long is your text?
The text is about 1200 characters. I've included it in a text file attachment. Within the text are URL's and extended characters. Not sure if that matters or not.
Support Team wrote: How long does it take it to enter it into the TextArea control?
It depends on how fast things are moving on all our VM's when the test is running. Sometimes it enters all the text in a few seconds (like 2 or 3), and sometimes it takes longer, like more than 20 seconds. Also, in IE10 they added spell checking and if you leave this on, it slows it down a bit more. Although I have to be honest and tell you that someone else on my team is reporting this problem to me (I'm the middle man), and I've been playing with it for a bit of time just now and I'm not able to get the text to take more than a few seconds to complete (even in IE 10 with spell check on). It DOES definitely move on to the next line of code beofre the press keys is done though, but in my testing, a delay of 5 seconds seems to be enough.
Support Team wrote: Do you see this behavior if you set the Text attribute as well?
I've got a TextAreaTag. How do I set the text for it?
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Typing a lot of text into a TextArea control

Post by Support Team » Tue Oct 22, 2013 5:08 pm

Hello Aracknid,

Unfortunately, I couldn't reproduce your issue on my machine.
The PressKeys() method should wait until it is finished before moving on to the next method.
I have used the following code snippet to achieve this:
txtArea.PressKeys(myText);
repo.Calculator.Self.Click();
It should be possible to set the TagValue of your TextArea as a workaround:
txtArea.Click();
txtArea.TagValue = myText;
Regards,
Markus (T)

User avatar
Aracknid
Posts: 388
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Typing a lot of text into a TextArea control

Post by Aracknid » Wed Oct 30, 2013 3:49 pm

Strange that you cannot recreate it, but I have switched my code to use TagValue.

Thanks.