Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..
521 views

copy paste a text in truclient

Hi,

Hope you are doing fine.

I need to copy a text from my email and paste it on another page (textbox). how i can perform that task in truclient script?

kindly help.

Best Regards

0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: copy paste a text in truclient

Hi @MikeAlpha ,

 

I would like to suggest you use the TruClient javascript API, create your own logic in javascript, use IO.read() to get your text from the email file, and keep it in a variable, then input your variable to the textbox.

see more about IO.read

 

Thanks,

Penn

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: copy paste a text in truclient

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: copy paste a text in truclient

Hi @MikeAlpha ,

can your email be opened from browser window?

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: copy paste a text in truclient

Yes Zhipeng Wang,

we are accessing email from browser trying to copy its contents and pasting these copied clipboard values in a text box on another application page.

Regards

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: copy paste a text in truclient

@MikeAlpha ,

I can understand your requirements now :),  here is the suggested steps:

1. add a navigation step that open your email in browser.

2. add a "Generic Object step", select the text object that you want. (in my case, I want to get the text "Examples in Every Chapter")

001.png

 

 

 

 

3. expand the step, change the step's action to "Get Property"

002.png

 

 

 

 

 

 

4. In the step's argument section, give your variable a name, in this way, a javascript variable "myVar" is created and it contains your text as its content.

003.png

 

 

 

 

 

5. Navigate to your target web page.

6. add a "Generic Object step" and select your target textbox.

004.png

 

 

 

 

7. set the Action of the object step to "Type"

005.png 

8. in the step's arguments, set the value with your javascript variable, note the yellow highlight part.

006.png

 

 

 

 

9. replay, in this way, the content of your javascript variable will be able to typed to your target textbox, in my case, the string "Examples in Every Chapter" is input to the textbox

007.png

 

BTW, if your want to only paste part of your string, then you need to add "evaluate JS step", write javascript code to split your string, make sure your JS variable only contains string that you want to paste.

 

 

Thanks,

Penn

Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: copy paste a text in truclient

Hi Zipeng Wang,

Thank you so much for all these efforts. really appreciate that.

Actually my desired value is dynamic it would change on next reply. how i can handle it?

you need to add "evaluate JS step", ok. how i will write java script code of copy text and paste text? kindly help.

Best Regards

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: copy paste a text in truclient

Hi,

Actually you should write your code to get or set your text to the target web element, try to use the "AUT" API,

e.g. var elem = AUT.document.getElementById('myInput');

 

you can find more from Work With JavaScript in TruClient scripts

 

Thanks,

Penn

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.