I want to delete the text present in the Java Edit box and want to add a new Text into that feild.
How can i perform this task in QTP (Scripting)?
I want to delete the text present in the Java Edit box and want to add a new Text into that feild.
How can i perform this task in QTP (Scripting)?
I'm not very familiar with the Java add in but AFAIK the Set
method replaces the text. If you really need to clear it first you can set to the empty string.
JavaWindow("win").JavaEdit("box").Set "" ''# Clear old text (optional)
JavaWindow("win").JavaEdit("box").Set "new value"
@TestGeek
If you want to use "ctl+A and delete" sequence, use .Type() method of Edit object.
If your object is not fully supported by QTP and does not have .Type() method, you can use WshShell.SendKeys() as a workaround (don't forget to set focus on the object first).
In QTP, constants are defined with "mic" (Mercury Integer Constant) prefix. You can search for the full list in help.
For those, that you mentioned, you need the following:
micCtrlDwn
"A"
micCtrlUp
micDel