Copy and paste?

Hello awesome community,

is there any way I could copy a text by giving its location and then paste it to a text box?

image

Hi Mike,

is the text in a web page or in an image in a web page? I’ll guess the latter is the reason for the question.

Libraries like Sukuli use tesseract-ocr, but if you don’t want to install Sukuli Library, you could just install the tesseract python module and make a custom keyword to take an image and return the text, this combined with regex might give you the result you need.

Hopefully I understood the problem?

Dave.

1 Like

It is actually a text in a web page.

In that case, you should be able to get the text value from the html to a variable and input it directly into the input field, no need to use the clipboard (you can if you want, but it’s extra steps)

Let me know which library you are using to drive the browser and i can tell you which keywords you need.

I am using the Selenium library. The text is dynamic, need to make sure each time that it grabs the one displayed.

Many thanks :slight_smile:

Get Text with a selector for the text you want will give you the text e.g:

    ${spacename}=    Get Text    //some/xpath

Then Input Text should input the value into the input field e.g:

    Input Text    //inputfield/xpath    ${spacename}

That should do it

but if you want to simulate the user using the clipboard, you’ll need to use one of the python libraries to push the variable value to the clipboard, then use Press Keys with a CTRL+v to paste the text into the field.

Hope that’s what you need,

Dave.