Disabled or Read-only textbox

21 posts, 0 answers
  1. QA
    QA avatar
    16 posts
    Member since:
    Mar 2011

    Posted 23 Jan 2012 Link to this post

    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
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 24 Jan 2012 Link to this post

    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.
  3. James
    James avatar
    26 posts
    Member since:
    Oct 2008

    Posted 27 Jun 2012 Link to this post

    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?
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 28 Jun 2012 Link to this post

    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
  5. Mamta
    Mamta avatar
    2 posts
    Member since:
    Aug 2015

    Posted 10 Aug 2015 Link to this post

    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

     

  6. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 10 Aug 2015 Link to this post

    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
     
  7. Mamta
    Mamta avatar
    2 posts
    Member since:
    Aug 2015

    Posted 11 Aug 2015 in reply to Cody Link to this post

    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

     

  8. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 11 Aug 2015 Link to this post

    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
     
  9. Helga
    Helga avatar
    7 posts
    Member since:
    Oct 2014

    Posted 12 Aug 2015 in reply to Cody Link to this post

    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;

  10. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 12 Aug 2015 Link to this post

    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
     
  11. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 18 Sep 2019 Link to this post

    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

  12. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 18 Sep 2019 Link to this post

    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.

  13. Elena
    Admin
    Elena avatar
    1222 posts

    Posted 19 Sep 2019 Link to this post

    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
     
  14. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 19 Sep 2019 in reply to Elena Link to this post

    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

  15. Elena
    Admin
    Elena avatar
    1222 posts

    Posted 20 Sep 2019 Link to this post

    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
     
  16. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 26 Sep 2019 in reply to Elena Link to this post

    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

  17. Elena
    Admin
    Elena avatar
    1222 posts

    Posted 01 Oct 2019 Link to this post

    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
     
  18. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 01 Oct 2019 in reply to Elena Link to this post

    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

  19. Elena
    Admin
    Elena avatar
    1222 posts

    Posted 02 Oct 2019 Link to this post

    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
     
  20. Yan Jun
    Yan Jun avatar
    39 posts
    Member since:
    Jan 2019

    Posted 11 Oct 2019 in reply to Elena Link to this post

    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? 

    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

  21. Elena
    Admin
    Elena avatar
    1222 posts

    Posted 15 Oct 2019 Link to this post

    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
     
Back to Top