Page 1 of 2

Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 4:16 pm
by zhuxy2000
I want to find special string in textarea and then insert something

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 4:19 pm
by Ciege
You will need to phrase your question a little better than that...

What type of AUT?
What IDE are you using (VS/Ranorex Studio)?
Are you using user code or recording?
What have you already tried?

The more information you provide the better we will be able to assist you...

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 5:09 pm
by zhuxy2000
I am testing web based application. We develop code in Visual Studio 2012 and import ranorex dll.
In textarea we long text like this:

jksadgjhsdfg() sdjksdfg [~11~] jsdgfjsd{}kfkdfgj()
...
...

We want to insert different stuff in () or {} or [~11~] . I try to move cursor to these special strings and right click mouse to insert parameters selected from popup menu

Thanks a lot

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 5:13 pm
by zhuxy2000
Could I treat textarea text as Ranorex.text and then move the cursor to the special string?

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 5:21 pm
by Ciege
I still fully don't understand your question... However...

If you have the textarea (as you call it) as an element and you can click on it (which sets the element as the currently enabled element) then you should be able to use the "Keyboard.Press" method from .NET to enter anything you want into the text area.

You can also (probably) set the value by modifying the Element.Value property (if your element has a value property). If you post a RanorexSnapshot for the AUT or element we could check that together...

Finally, you mentioned a new issue with Right Click & Popups... You can right click on any element by using the method "Element.Click(MouseButtons.Right)" then interacting with the popup however you want.

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 7:57 pm
by zhuxy2000
The text in Ranorex.textareatag is as following:
The Author Name:[~11~]; Age:[~22~]; Address:[~33~];
dfgsd:[~44~]; sdfgsdfgsdfg:[~55~]; sdfg:[~66~];
...

I want to replace [~11~],[~22~],[~33~],[~44~],[~55~],[~66~] with popup menu item to:
ÿNameÿ
The Author Name:[ ÿNameÿ]; Age:[ ÿAgeÿ]; Address:[ÿAddressÿ]
...


You are right: you can use Ranorex.TextAreaTag.TagValue to get the text in Textarea and replace [~11~],[~22~],[~33~],[~44~],[~55~],[~66~] directly in this stringvalue with the parameters in popup menuitem and then use Ranorex.TextAreaTag.Presskeys(stringvalue) to re-set Ranorex.TextAreaTag text

But that is not what I want. What I want is to move the mouse to [~11~], right click mouse and then insert the paramenter directly

The content in this textarea is a template and [ÿNameÿ]; Age:[ ÿAgeÿ]; Address:[ÿAddressÿ] will be replaced by real value in application

Thanks a Lot,

Re: Could I find and select text in Textarea?

Posted: Fri Oct 26, 2012 8:46 pm
by Ciege
OK, Again, can you post a RanorexSpy Snapshot? It would help...

And also, once you have the element you can do a "Element.Click(MouseButtons.Right)"...

Since I don't have a RanorexSnapshot to work with, I am only guessing here...

In the TextArea, is all that info in just one element or is there a specific element for each item (i.e. one for name, one for age, etc..)? If a separate element for each, then get that element and right click it. If they are all in one element then you need to do some work such as, determining through code the length of each part of text then clicking in the appropriate X/Y coordinate within the text area.

Please post a RanorexSpy Snapshot.

Re: Could I find and select text in Textarea?

Posted: Tue Oct 30, 2012 8:43 pm
by zhuxy2000
To simplify the problem: could I move mouse to some point in TextArea? or could I move mouse to special string like [~11~] and highlight it?

As I know in some other automation test tools, user can move mouse to some special string like this:[~11~] by using method like this textarea.textexist(stringToFind) or textarea.textselect(stringToFind).

Thanks a lot,

Re: Could I find and select text in Textarea?

Posted: Tue Oct 30, 2012 9:54 pm
by Ciege
Since I can't see your element and it's attributes (why I have asked for a RanorexSpy Snapshot several times) I cannot specifically tell you how to call the mouse move...

You can try using the GDI functionality from within Ranorex to work directly with free form text. Not sure if it will do what you want, as I've never used it:
http://www.ranorex.com/search.html?q=gdi

Re: Could I find and select text in Textarea?

Posted: Wed Oct 31, 2012 4:50 pm
by Aracknid
I'm going to try to clarify what my co-worker is asking, but I'm going to dumb it down a bit. There's also a pictures to help. :D Don't understand why a snap shot is required?

We've got an HTML TextArea that contains some text, spanning multiple lines. There is a feature in our program (that we need to test) that allows the user to right-click the mouse within the textarea to bring up a menu that contains a list of pre-populate text (how this text appears in the menu is not important). When the text from the menu is selected, it is inserted into the text area in the exact place where the mouse pointer was when we right-clicked.

So our problem is, how do we move the mouse to the exact spot we want, so that when we right-click and insert the text, it will be where we want?

Forget about previous examples. Say I have a textarea with multiple lines like such:
email.jpg
How can I move the mouse to the X (X marks the spot), so that when I right-click the mouse on the X and choose my text, the result will be as such..?
email2.JPG
Thanks,

Aracknid

Re: Could I find and select text in Textarea?

Posted: Wed Oct 31, 2012 5:13 pm
by Ciege
OK, that is making a little more sense to me now...
Don't understand why a snap shot is required?
Well, so that I can see the element, it's attributes and what is given to you to work with.

As for your specific question, I'm not sure there is a built in way for Ranorex to click on a specific character within a text area. So you will probably need to develop some custom code that finds the element and parses the chars yourself to find where the char is you want to click on. You will need to determine the size of the text in code then count over to the appropriate location to know where to click.

This is just my suggestion for how to do it (off the cuff) but there may be other suggestions from Support or other members...

Re: Could I find and select text in Textarea?

Posted: Thu Nov 01, 2012 10:00 am
by artur_gadomski
We have almost exact scenario. We have a control with text in it where some text is clickable and some not. We would like to find ad click a certain string within a text box.
I haven't looked into a GDI plugin as we only needed to click one text so far so we got away with clicking a pixel but having some generic solution that does that would be nice.
Let me know if you find anything that works.

Re: Could I find and select text in Textarea?

Posted: Fri Nov 02, 2012 2:57 pm
by Support Team
Hi,

In order to analyze this issue in detail we would need a Ranorex snapshot file or even better a sample solution of that control.

Thanks,
Markus

Re: Could I find and select text in Textarea?

Posted: Fri Nov 02, 2012 3:12 pm
by Aracknid
Hi,

This is not an issue, it's a question. We just want to know if it is possible to do what we asked, and if so how. There's nothing special or tricky here. All you need is an HTML page that has an HTML Text Area in it with multi line text. How can you right click the mouse on a specific letter or word in that text area.

Aracknid

Re: Could I find and select text in Textarea?

Posted: Mon Nov 05, 2012 10:54 am
by Support Team
Hi,

If this is a normal HTML Text Area it is not possible to click on a specific text, except if you would use coordinate or image based actions.

Regards,
Markus