复制文本并粘贴到 UFT 中

Copy text and paste in UFT

我想从网页上复制一段文字,然后将其粘贴到同一网页的另一个字段中。

这是我迄今为止尝试过但没有成功的方法

这是我的代码:

Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$Tabs").GetROProperty + micCtrlDwn + "a" + micCtrlUp
Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$Tabs").GetROProperty + micCtrlDwn + "c" + micCtrlUp
Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$TabsCPe_3").Click
Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$TabsCPe_3").GetROProperty + micCtrlDwn + "v" + micCtrlUp

它点击了我需要它从中复制文本但没有select所有文本并将其复制到定义目标的字段。

Object properties for feild1 after entering text manually

feild1 object spy

为什么不从 field1 中获取值,将其存储在变量中并将该值设置为 field2,如下所示:

Dim strValue
'fetch the value from field1 and store it in a variable
strValue = Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$Tabs").getRoProperty("value")

'set that value to field2
Browser("Candidate").Page("Candidate").WebEdit("ctl00$Main$TabsCPe_3").set strValue