Vbscript QTP/UFT-在SendKeys函数中包含一个全选文本

Vbscript QTP/UFT-在SendKeys函数中包含一个全选文本,vbscript,qtp,hp-uft,uft14,Vbscript,Qtp,Hp Uft,Uft14,所以我有这个发送键功能: 代码: 但是我想做的是在这个函数中包含一种方法,首先在WebEdit字段中选择文本,然后输入数据 目前我所做的是: 代码: 因此,基本上我想做的是将上述内容组合成一条语句,执行select all文本并插入所需文本。简单地说,只需在sendkeys函数中添加一行即可: Public Function sendKeys(Obj, strParam) Wait(1) Obj.Click Dim shell Set shell = Create

所以我有这个发送键功能:

代码:

但是我想做的是在这个函数中包含一种方法,首先在WebEdit字段中选择文本,然后输入数据

目前我所做的是:

代码:


因此,基本上我想做的是将上述内容组合成一条语句,执行select all文本并插入所需文本。

简单地说,只需在sendkeys函数中添加一行即可:

Public Function sendKeys(Obj, strParam)
    Wait(1)
    Obj.Click
    Dim shell
    Set shell = CreateObject("WScript.Shell")
    shell.SendKeys "^a" 'New line
    shell.SendKeys strParam
    set shell = Nothing
    Wait(2) 
End Function

简单地说,只需在sendkeys函数中添加一行:

Public Function sendKeys(Obj, strParam)
    Wait(1)
    Obj.Click
    Dim shell
    Set shell = CreateObject("WScript.Shell")
    shell.SendKeys "^a" 'New line
    shell.SendKeys strParam
    set shell = Nothing
    Wait(2) 
End Function

如果该字段是
WebEdit
,只需使用
WebEdit
.Set
方法即可,该方法基本上满足您的要求,因为如果该字段是
WebEdit
,它将清除该值并将其设置为您想要的任何值,只需使用
webedit
.Set
方法,该方法基本上可以满足您的要求,因为它将清除值并将其设置为您想要的值
Public Function sendKeys(Obj, strParam)
    Wait(1)
    Obj.Click
    Dim shell
    Set shell = CreateObject("WScript.Shell")
    shell.SendKeys "^a" 'New line
    shell.SendKeys strParam
    set shell = Nothing
    Wait(2) 
End Function