Selecting text randomly

Asked by Sambit Das

Hi

I need to automate following scenario. Tell me can I use Sikuli for this.

Select a group of text present in a web page by clicking the left click of the mouse. On releasing the left click of the mouse one menu appears. I need to handle the menu too. But prior to that I want to know how can I select the text, release the mouse, handle menu options.

Can I handle this using sikuli.
N.B. unable to inspect through any of the locators of selenium. The content present in a xhtml page. so unable to identify through
xPath also.

Kindly suggest a solution.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Eugene S (shragovich) said :
#1

The text selection process that you described is not clear.
Please describe it step by step.

Do you just click once on the text to select it?
Do you have to select it by dragging the mouse?
Is this text selectable? Meaning that you can navigate in this textbox with your keyboard and perform key combinations like CTRL + 'A', CTRL + 'C'?

Revision history for this message
Sambit Das (sambitdas-qa) said :
#2

Hi Eugene

The text selection should be done through mouse only. Here no keyboard action.
Steps:
1. Randomly pick a paragraph .

2. Click/Hold the left click of mouse and drag down to a certain point (or the end of paragraph).

3.Release the left click of the mouse . one menu will appear.

4. Need to perform different action on the options present in the menu.

Is sikuli able to perform this kind of operations .

N.B. Again the content of the webpage in xhtml page.

Revision history for this message
Eugene S (shragovich) said :
#3

Yes, such scenarios can be automated with Sikuli.
It might be hard working with multiple areas, especially if you want to perform precise mouse action within these areas. You will have to think how can you define your paragraph in a robust way (remember that sikuli is 100% visual).

As to moving the mouse itself, you can use these commands:
http://doc.sikuli.org/region.html#low-level-mouse-and-keyboard-actions

Again, your main challenge is going to be robust definition of the regions you want to interact with.

Revision history for this message
Sambit Das (sambitdas-qa) said :
#4

Hi Eugene

I didnt understand. Could you please share me in detail . I mean what do you mean by robust way of defining paragraph to handle mouse actions.

Thanks
Sambit

Revision history for this message
Sambit Das (sambitdas-qa) said :
#5

Sorry Eugene

That was I wrongly clicked as solved. But still not solved the issue .
Today I was trying to perform the action but didnot succeed . I was trying with the following code:

mouseDown(Button.LEFT)
mouseMove(Env.getMouseLocation().offset(10, 10))
mouseUp()

This code I got from the following webpage:

http://doc.sikuli.org/tutorials/resize/resize.html
Since I dont know what are the parameters need to pass for this. it didnt succeed.

Could you please make me understand about the above code. So that I can implement it. I am sure it can solve the issue

Thanks
Sambit

Revision history for this message
Sambit Das (sambitdas-qa) said :
#6

Hi Eugene

My issue is similar to the following issue:

In MS-Word If you have any text present in a .docx file. If you select a group of text by holding the left click of the mouse and after the releasing the left click of the mouse one menu appears with different options.

I need to handle a similar issue to click the various options present in the menu.

Revision history for this message
Eugene S (shragovich) said :
#7

Hi,

I am still having a trouble understanding what is that you are trying to do and what doesn't work for you. You started talking about randomly picking a paragraph and what was my first question to you. How do you define a paragraph? Sikuli doesn't know what paragraph is. You have to VISUALLY define it. That means, for example, to take a screenshot of the paragraph. But since in your case you want it random, you will have to define another region and use it as a pivot and locate the paragraphs based on that region. Hopefully this is clear.

Now to your other question regarding the code that didn't work for you with holding the mouse and dragging it. What exactly didn't work? Did you get any errors? Did anything unexpected happen?

Revision history for this message
Sambit Das (sambitdas-qa) said :
#8

Hi Eugene

If there are 10 lines present in a paragraph. Out of the 10 lines Suppose I need to create Highlight for 2 lines only. So I will Click the left Button of mouse and hold to the end of the next line. When the Left Button is released there one menu option opens.

Here I want to know How to select those two lines. Forget about paragraph. I need to select a group of text say.

Now I guess you have understood my problem.

Revision history for this message
Eugene S (shragovich) said :
#9

I think I understand the question but you didn't say what's currently wrong with this code example that you attached. Errors? anything? How does it fail?

Revision history for this message
Sambit Das (sambitdas-qa) said :
#10

Eugene
 the script I mean the method of java gets passed. But It's not performing the required action. Thats the reason I am Confused.
It will be very helpful if You can make me understand the use of MouseDown,MouseMove And mouseUp . How to use this three
methods.

Thanks a lot in advance

Revision history for this message
RaiMan (raimund-hocke) said :
#11

mouseDown() -- the specified mouse button is pressed an held until a corresponding mouseUp()
mouseUp() -- the specified mouse button is released (or all buttons if no parameter)
mouseMove() -- the mousepointer is moved to the specified location (nothing done with the buttons)

Can you help with this problem?

Provide an answer of your own, or ask Sambit Das for more information if necessary.

To post a message you must log in.