Inserting Text instead of Keying
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Inserting Text instead of Keying
I need to be able to verify the maximum characters allowed can be saved into various forms on an online web application. The objects are considered "textarea" are do not allow the SetText method, but the Keying method does work. Some of the fields allow 4,000 characters, when using the Key method for those it takes a long time for the test to Key in 4,000 characters. Is there a faster way of inserting/pasting/setting the text contained in the variable into these fields w/o the automated test keying in 4,000 characters?
I saw this post which implied that the text from a variable could be inserted, but did not really state how to do that.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's how you do it from a variable, but if you are restricted to Keys, then it will still take a lot of time because Keys is meant to simulate a person typing.
Create a variable to hold your max characters
Use that variable as the input for Keys
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you directly set the .text or .wText (or similar) property for the textarea? Rather than using a SetText() or Keys() method?
--------------------
Senior SQA Automation Engineer
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Marsha_R - I am currently doing it this way, but want to know if there is a faster method than Keying since that method takes so long.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi tphillips - this is what I am wondering, I am not sure how this could be done. it would be nice to be able to take a variable which stores the 4000 character text string and use that to set the property for innertext, textContent.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
> a [...] way of inserting/pasting [...] the text
You almost answered your own question.
Something like this (pseudocode):
var strText = '<generated string of 4000 chars in length>';
var testedObj = ...; // get a reference to the required object
Sys.Clipboard = strText;
testedObj.Keys('^V'); // Ctrl-V to paste the content of the clipboard into the field
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AlexKaras - thanks, I use all namemapping for my testing and my coding is close to nothing. I'll take what you have here and work with it.
Thank you!
