This is a migrated thread and some comments may be shown as answers.

Disabled or Read-only textbox

20 Answers 378 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
QA
Top achievements
Rank 1
QA asked on 23 Jan 2012, 07:54 PM
Hi,

How can I extract or verify data from disabled or read-only textbox?

1) I cannot even extract or verify the data on disabled field
2) I tried to extract and also verify the data on read-only field but the it fails with the following error while executing the test

'1/23/2012 1:53:30 PM' - 'Fail' : 42. Verify TxtRemainingAmountWorkingReceiptTextbox's text content Same '120.00'------------------------------------------------------------Failure Information: ~~~~~~~~~~~~~~~[Silverlight Extension Error] Details: ArtOfTest.WebAii.Silverlight.NoSuchPropertyException: Property 'Text' does not exist on the element at Telerik.TestingFramework.XamlExtension.ClientServices.GetRealProperty(AutomationReference reference, AutomationProperty property) at Telerik.TestingFramework.XamlExtension.ClientProcessor.ProcessCommand(String command)InnerException:ArtOfTest.WebAii.Silverlight.ExecuteSilverlightCommandException: [Silverlight Extension Error] Details: ArtOfTest.WebAii.Silverlight.NoSuchPropertyException: Property 'Text' does not exist on the element at Telerik.TestingFramework.XamlExtension.ClientServices.GetRealProperty(AutomationReference reference, AutomationProperty property) at Telerik.TestingFramework.XamlExtension.ClientProcessor.ProcessCommand(String command) at ArtOfTest.WebAii.Silverlight.SilverlightProxy.ExecuteSLCommand(SilverlightCommand cmd) at ArtOfTest.WebAii.Silverlight.SilverlightProxy.GetProperty(AutomationProperty property, IAutomationPeer peer) at ArtOfTest.WebAii.Silverlight.AutomationObject`1.GetProperty(AutomationProperty property) at ArtOfTest.WebAii.Design.IntrinsicTranslators.Silverlight.Descriptors.PropertyVerificationDescriptor.GetProperty(FrameworkElement element, String propertyName, Type propertyType, String attachedPropertyOwner) at ArtOfTest.WebAii.Design.IntrinsicTranslators.Silverlight.Descriptors.PropertyVerificationDescriptor.ExtractData(IApplication hostApp, DescriptorValueStore dataStore) at ArtOfTest.WebAii.Design.Extensibility.XamlVerificationDescriptor.ExtractData(IAutomationHost targetHost, DescriptorValueStore dataStore) at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)


Thank You,
Dipti

20 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 24 Jan 2012, 04:32 PM
Hello Dipti,

I am unable to reproduce this issue. See screen shot 1 for a test I created against a public Silverlight site. After navigating to the site, I clicked "DataForm" in the left-hand menu. I then targeted the "Cancel" button element (screen shot 2).

Notice that the Text Verification and Extract steps are targeted against the child TextBlock element within the Button, whereas the "Verify IsEnabled Equal False" is targeted against the parent Button element itself.

If you continue to have difficulty, please point me to a public site where I can replicate the issue.

Regards,
Anthony
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
James
Top achievements
Rank 1
answered on 28 Jun 2012, 03:18 AM
Hi Anthony,

I am using WebAii Testing Framework for test automation of Silverlight Web application.
Our environment is :
  • Silverlight 5, 
  • Telerik_Testing_Framework_2012_1_528_FREE_EDITION 
  • .NET 4
  • IE-9

I have a read only TextBlock and trying to read the text using
TextBlock.Text
But this line throws following exception. TextBlock is Visible & clickable.

Source: ArtOfTest.WebAii, 
Message: [Silverlight Extension Error] Details: ArtOfTest.WebAii.Silverlight.NoSuchPropertyException: Property 'Text' does not exist on the element
   at Telerik.TestingFramework.XamlExtension.ClientServices.GetRealProperty(AutomationReference reference, AutomationProperty property)
   at Telerik.TestingFramework.XamlExtension.ClientProcessor.ProcessCommand(String command), 
Stack Trace:
   at ArtOfTest.WebAii.Silverlight.SilverlightProxy.ExecuteSLCommand(SilverlightCommand cmd)
   at ArtOfTest.WebAii.Silverlight.SilverlightProxy.GetProperty(AutomationProperty property, IAutomationPeer peer)
   at ArtOfTest.WebAii.Silverlight.AutomationObject`1.GetProperty(AutomationProperty property)
   at ArtOfTest.WebAii.Silverlight.UI.TextBlock.get_Text()


Could you please help me with this exception?
0
Anthony
Telerik team
answered on 28 Jun 2012, 02:33 PM
Hello James,

I am not able to reproduce that error on a public Silverlight site:

Settings.Current.Web.EnableSilverlight = true;
Settings.Current.Web.SilverlightConnectTimeout = 60000;
Manager.LaunchNewBrowser();
 
SilverlightApp app = ActiveBrowser.SilverlightApps()[0];
TextBlock tb = app.Find.ByTextContent("Welcome to the Silverlight Toolkit").As<TextBlock>();
 
Log.WriteLine("Text: " + tb.Text);

Please provide sample code against a publicly accessible site so I may see your issue first-hand.

Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Mamta
Top achievements
Rank 1
answered on 10 Aug 2015, 02:57 PM

Hi,

I have to read the text of a textbox which is disabled but whenever I do that using below code:

var Bonuspoints = CasinoCardEditWindow.Find.ByName("BonusPoints").Text;

But it shows me the below error:

The name 'Bonuspoints' does not exist in the current context.

 Please suggest how can I read the data of a disabled textbox.

 

Thanks

Mamta

 

0
Cody
Telerik team
answered on 10 Aug 2015, 09:31 PM
Hello Mamta,

Assuming the XAML for my Silverlight application looks like this:
<TextBox Name="BonusPoints" Height="23" HorizontalAlignment="Left" Margin="12,219,0,0" VerticalAlignment="Top" Width="120" Text="ABC 123" IsReadOnly="True" />

I would locate the element then extract the text using this code:

TextBox Bonuspoints = Pages.SilverlightApplication1.SilverlightApp.Find.ByName("BonusPoints").As<TextBox>();
Log.WriteLine(Bonuspoints.Text);


Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Mamta
Top achievements
Rank 1
answered on 11 Aug 2015, 06:08 AM

Hi,

 I tried it this way for my WPF App but it still doesn't work. What I am doing is below:

TextBox Bonuspoints = CardEdit.Find.ByName("BonusPoints").As<TextBox>();

var BonuspointsData = Bonuspoints.Text;

 

Thanks

Mamta

 

0
Cody
Telerik team
answered on 11 Aug 2015, 07:55 PM
Hi Mamta,

I was unaware you're working with a WPF application. Here's sample code:

TextBox readOnlyTextBox = ActiveApplication.WaitForWindow("MainWindow").Find.ByName("BonusPoints1").As<TextBox>();
Log.WriteLine(readOnlyTextBox.Text);
 
TextBox disabledTextBox = ActiveApplication.WaitForWindow("MainWindow").Find.ByName("BonusPoints2").As<TextBox>();
Log.WriteLine(disabledTextBox.Text);

I've attached a sample Test STudio project as well as a WPF application it runs against.


Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Helga
Top achievements
Rank 1
answered on 12 Aug 2015, 08:12 AM

Hi,

 The problem is not the WPF APP , I wrote the code as per WPF App only but the problem is while writing the data in the read only or disabled textbox into a variable. Since I want to keep my data in a variable and will be using it to compare it with some other variable but that doesn't work. This particular line ("var BonuspointsData = Bonuspoints.Text;")  doesn't execute.

TextBox Bonuspoints = CardEdit.Find.ByName("BonusPoints").As<TextBox>();
var BonuspointsData = Bonuspoints.Text;

0
Cody
Telerik team
answered on 12 Aug 2015, 02:43 PM
Hi Mamta,

There's nothing obvious to me why your code is not working as expected. Is it possible for you to send me a sample WPF application plus Test Studio test project that demonstrates the problem? Once I can reproduce your issue on my machine I'll be able to investigate and discover that is causing the problem.

Assuming you can do this, put the entire WPF app into one zip file, then the test project into another separate zip file and attach both to this thread. If you're worried about security, you can create a separate support ticket. Support tickets are very private and confidential. Only you and Telerik support has access to support tickets and their contents.


Regards,
Cody
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 19 Sep 2019, 03:19 AM

Hi,

If I am not misunderstanding the topic, this should be a post about verifying data in a disabled field in Silverlight.

I have similar issue as well, but on Kendo checkbox.

I am trying to verify if the checkbox is checked or not when the checkbox is disabled.

An example can be found here on "Disabled and checked".

Does anyone know how to verify the checkbox in that case?

Thanks in advance.

Regards,

Yan Jun

0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 19 Sep 2019, 03:56 AM

I know that this post here suggested "Build Step" or write a code.

Before moving into writing code, I have tried "Build Step" but cannot find checked state in Verification - Attributes.

Would really appreciate if anyone can tell me which part I have done wrong.

0
Elena
Telerik team
answered on 19 Sep 2019, 08:09 AM

Hello Yan,

You can use Advanced verification in Test Studio tests to check the state of any attributes for an element. I hope this will work for you to cover the current scenario. 

Regards,
Elena
Progress Telerik

 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 19 Sep 2019, 08:43 AM

Hi Elena,

For this disabled Kendo checkbox, even if I hover over the checkbox I could not capture the exact checkbox but only the div.

Only after searching for the exact checkbox inside DOM and select it, then I have managed to Build Step and verify the element check state.

Thanks for the suggestion.

Regards,

Yan Jun

0
Elena
Telerik team
answered on 20 Sep 2019, 01:56 PM

Hello Yan,

I am glad to know you found a way to locate the correct element in the DOM tree. 

However, if there is no sample application to test the misbehavior with highlighting, I will not be able to determine what the trouble could be. So, if there is any chance to share a public accessible application which can demonstrate the issue, I can explore it.

Thanks for your understanding in advance. And, please, if you have troubles with the advanced verification, do not hesitate to get back to us.

Regards,
Elena
Progress Telerik

 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 27 Sep 2019, 02:23 AM

Hi Elena,

Thanks for getting back. Can you please kindly try the "Disabled and checked" checkbox in this page and see if you are able to hit the same issue as me?

Thank you.

Regards,

Yan Jun

0
Elena
Telerik team
answered on 01 Oct 2019, 12:01 PM

Hi Yan,

The input controls of type checkbox are automatically detected in Test Studio and the Step Builder in the Recorder Toolbar provides options specific for that control. In this case  the options you need are 'Checked' and 'Enabled' - please see the screenshot for reference. 

Please, also find a sample project with a test, which covers the scenario to check all of the checkboxes - whether they are enabled, or disabled. I hope this will be helpful as well. 

In case of further questions, please let me know. 

Regards,
Elena
Progress Telerik

 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 02 Oct 2019, 01:19 AM

Hi Elena,

I have no problem in checking or unchecking the enabled checkbox.

I am aware of the options "Checked" or "Enabled".

The one I am having issue with is the disabled checkbox. I want to record steps to verify a disabled checkbox whether it is checked or not. It does not seem like it is automatically detected on my end.

Please check the attached images on how I only manage to verify either the checkbox text or the entire li for the checkbox, but never the checkbox itself.

I am able to verify checked or enabled for the enabled checkbox for sure.

I have checked your attached test file and still do not know how are you able to verify the disabled checkbox through recorder but not through the DOM. I can only build steps on the disabled checkbox after locating it in the DOM.

Regards,

Yan Jun

0
Elena
Telerik team
answered on 02 Oct 2019, 03:44 PM

Hello Yan,

I reviewed the shared screenshots and noticed that the elements you are highlighting are different - the li, the label, and the input. It is only the input control that will list the enabled/disabled option in the Elements menu. Can you please, try this on your end? Will you be able to add the verification step from the Elements menu if the input control is highlighted? 

I do understand that using the highlighting and the quick steps menu is easier. There are occasions, however, when the application under test is quite complex and using the DOM explorer can be more helpful. 

Since we are using a sample page in our discussion, I am not familiar with the one you need to automate. So, I will be happy to know if you have troubles while recording the actual scripts against the page under test? Do you face some troubles in using both the highlighting feature and DOM explorer in the Recorder toolbar? 

I hope that we will manage to sort out any possible issues you may facing.

Thank you for your cooperation throughout our conversation.

Regards,
Elena
Progress Telerik

 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Yan Jun
Top achievements
Rank 1
Iron
Veteran
answered on 11 Oct 2019, 10:17 AM
[quote]Elena said:

Hello Yan,

I reviewed the shared screenshots and noticed that the elements you are highlighting are different - the li, the label, and the input. It is only the input control that will list the enabled/disabled option in the Elements menu. Can you please, try this on your end? Will you be able to add the verification step from the Elements menu if the input control is highlighted? 

[/quote]

Hi Elena,

I tried to point my mouse directly at enabled checkbox and disabled checkbox (not the text) and attached the screenshot of what the 'Highlight Element' detects when I performed the same step at two different checkboxes. Please kindly refer to the attached screenshots again (sorry). I tried to highlight the disabled checkbox. I can only highlight either the li or the label only. I cannot highlight the input for the disabled checkbox. As for enabled input, I will be able to highlight the input.

The sample page and the AUT on my side are having the same control. So currently we are still facing the same issue in the AUT.

DOM explorer solves the problem for sure. But I am wondering how are you able to highlight the disabled input without any problem on the exact same page as I was trying but failed to do the same.

Regards,

Yan Jun

0
Elena
Telerik team
answered on 15 Oct 2019, 02:51 PM

Hello Yan Jun,

i actually highlighted only the first checkbox element and then used the DOM explorer for the rest.

Though, I reviewed the shared details once again and checked the same on my end to confirm that only the enabled checkboxes can be directly highlighted. The other two, which are in disabled state need to be located in the DOM explorer to add verification steps against these. This behavior is expected because the elements are disabled and actually no actions can be performed against them. 

As far as I understand you are able to add necessary verifications through the DOM explorer and the step builder in the recorder toolbar - is there something that you are not able to accomplish in the actual application under test? 

Thank you once again for the cooperation in our discussions. 

Regards,
Elena
Progress Telerik

 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
QA
Top achievements
Rank 1
Answers by
Anthony
Telerik team
James
Top achievements
Rank 1
Mamta
Top achievements
Rank 1
Cody
Telerik team
Helga
Top achievements
Rank 1
Yan Jun
Top achievements
Rank 1
Iron
Veteran
Elena
Telerik team
Share this question
or