Ask a Question

Error " Failed to enter text in the edit box, since it is read-only " when editing a WPF application

Nikolayev
Contributor

Error " Failed to enter text in the edit box, since it is read-only " when editing a WPF application

Hello SmartBear Community

 

Can you Help please

 

I Have a test that must change the name So'phie to Sophie  in this application :

Nikolayev_2-1683209103332.png

 

The fields are fully editables and I can do it manualy  like this :

 

Nikolayev_3-1683209320049.png

 

 

But when it is testcomplete I have this error :

Nikolayev_4-1683209465539.png

 

We tryed severals thing with delay but it not OK

 

 

Can you Help please

 

Thanks 

 

Kinf Regards

 

Nicolas, Nikolayef

 

 

 

16 REPLIES 16
rraghvani
Champion Level 2

Is this a desktop or web application? Are you using script or keyword test? Have you just tried with "Sophie"?

AlexKaras
Champion Level 2

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.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

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]"

It is a keyword test 

I type this

 

TextBox SetText "Sophie" Enters the text 'Sophie' in the 'TextBox' text editor.

Nikolayev
Contributor

I accept as a solution but it is a mistake, I don't know how to remove 

it is the reply @rraghvani 

It is a keyword test and  I type this :

TextBox SetText "Sophie" Enters the text 'Sophie' in the 'TextBox' text editor.

rraghvani
Champion Level 2

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"

rraghvani_0-1683273282376.png

 

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.

AlexKaras
Champion Level 2

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.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: