Looking to copy text from a specific location in a browser

Asked by Gokul Sridharan

Hello,

I am looking copy text from a specific location in a web page?

How do I do that?

Thanks,

Gokul

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
obiwan-92 (obiwan-92) said :
#1

Hello.

Select the text you want to copy by make a double click, then :
type('c', KeyModifier.CTRL)
text = Env.getClipboard()

Regards.

Revision history for this message
Gokul Sridharan (gokul811) said :
#2

Yes I tried that, but it doesn't copy the entire line of text or paragraph of text right?

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

Hi,

In that case I can immediately think about 2 options. Maybe there are more..

Option 1:
Usually lines can be selected by triple clicking near the beginning of that line, i.e. a bit to the left from the first word in line.
The idea is to choose the area correctly, to be in same line as the text you want to copy.

The "triple click" itself can be done this way:

for i in range(3):
   mouseDown(16)
   mouseUp(16)
   type("c", KEY_CTRL)
   wardName = Env.getClipboard()

Option 2:
Use the dragDrop() method. Exalained here:
http://doc.sikuli.org/region.html#Region.dragDrop

here you will have to provide start and end coordinates

Cheers,
Eugene S

Can you help with this problem?

Provide an answer of your own, or ask Gokul Sridharan for more information if necessary.

To post a message you must log in.