Disabled or Read-only textbox

10 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 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
    3136 posts

    Posted 10 Aug 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 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
    3136 posts

    Posted 11 Aug 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 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
    3136 posts

    Posted 12 Aug 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
     
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!