tags:

views:

24

answers:

2

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)?

+1  A: 

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" 
Motti
No this will not work correctly in all times, Becoz if the Content is having White spaces or anything such than it will not work. I guess something like ctl+A and delete operation i want to perform. How can i achieve this in QTP or VB?
TestGeeK
+2  A: 

@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

Albert Gareev