Forum Discussion
- rraghvaniChampion Level 3
Is this a desktop or web application? Are you using script or keyword test? Have you just tried with "Sophie"?
- NikolayevContributor
It is a keyword test
I type this
TextBox SetText "Sophie" Enters the text 'Sophie' in the 'TextBox' text editor.
- NikolayevContributor
Same Problem with a script
- AlexKarasChampion Level 3
> Same Problem with a script
Can you provide actual code that does not work?
Also it might help if you provide test log for this piece of code.
- AlexKarasChampion Level 3
Hi,
Can you provide a code snippet that you use to enter data in the field?
I am just guessing that read-only control might become enabled when human user focuses it.
For example, control.Keys("Sophie") might not work, but
control.Click(); // this will, for example, replace read-only label with editable text-box
parentControl.Keys("Sophie"); // control cannot be used as it was destroyed, but its parent might exist and can be used
might appear to work.
- NikolayevContributor
Thank you for reply
It is not a web app but desktop appl
here are the steps :
Aliases.JANUA_UI_WPF.HwndSource_MainWindow.ClickItem
Aliases.JANUA_UI_WPF.HwndSource_MainWindow.ClickItem.SetText"Sophie"Aliases.JANUA_UI_WPF.HwndSource_MainWindow.ClickItem.Keys"[Enter]"
- NikolayevContributor
I accept as a solution but it is a mistake, I don't know how to remove
- rraghvaniChampion Level 3
Use the Object Spy tool to spy on First Name edit box and create a name mapping called Firstname. Then call the following code (JavaScript) to see if it works,
Aliases.JANUA_UI_WPF.HwndSource_MainWindow.Firstname.SetText("Sophie")
If the above does not work, then try to Record Script, to see how TestComplete has identified the object and the method used to enter "Sophie"
The name mapping has to be correctly setup to identify the UI control, otherwise TestComplete will not be able to find or interact with the UI control.
To undo the accepted solution, click on the 3 dots and select un-accept solution or not the solution.
- AlexKarasChampion Level 3
Hi,
I would replace .SetText() with .Keys().
Does it help?
If it does not help, could you provide actual code that does not work?
P.S. I marked all replies as not solutions.
- rraghvaniChampion Level 3
Are you able to provide a screenshot of the Object Browser and the properties of that UI control?
- NikolayevContributor
here it is :
- rraghvaniChampion Level 3
Without entering any data in that control, can you take another screenshot with Advanced View - so that we can see all the properties being exposed by the control
Like this for example, Object Browser and Properties
- eykxasRegular Contributor
I don't know if it can help but sometimes, when TC can't set a text I use a little script of my own and doing it in a fully manual way.
Click on the field then using this function :
function super_typing_keyboard(value){ var i = 0; var lt = value.length; for (;i < lt; i++){ var chr = aqString.GetChar(value, i); var chrK = Win32API.VkKeyScan(aqString.GetChar(value, i)); var lowByte = chrK & 255; var highByte = (chrK >> 8 ) & 255; // 1 Either SHIFT key is pressed. var shift = highByte & 1; // 2 Either CTRL key is pressed. var ctrl = highByte & 2; //4 Either ALT key is pressed. var alt = highByte & 4; if(shift){ LLPlayer.KeyDown(VK_SHIFT, 50); LLPlayer.KeyDown(lowByte, 50); LLPlayer.KeyUp(lowByte, 50); LLPlayer.KeyUp(VK_SHIFT, 50); }else if(alt){ LLPlayer.KeyDown(VK_MENU, 50); LLPlayer.KeyDown(lowByte, 50); LLPlayer.KeyUp(lowByte, 50); LLPlayer.KeyUp(VK_MENU, 50); }else if(ctrl){ LLPlayer.KeyDown(VK_CONTROL, 50); LLPlayer.KeyDown(lowByte, 50); LLPlayer.KeyUp(lowByte, 50); LLPlayer.KeyUp(VK_CONTROL, 50); }else{ LLPlayer.KeyDown(lowByte, 50); LLPlayer.KeyUp(lowByte, 50); } } }
- rraghvaniChampion Level 3
There's a WPF demo application that TestComplete have provided, and the following code works
Seems like you have to use Click(), followed by the Keys() method.
SetText() method did not seem to work for me - also, I don't have the Desktop module license installed
Related Content
- 2 years ago
- 4 years ago
Recent Discussions
- 16 hours ago
- 17 hours ago
- 4 days ago