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

I am having trouble with TypeText not working as expected...

7 Answers 45 Views
ASP.NET AJAX WebAii RadControls
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniel Corbett
Top achievements
Rank 1
Daniel Corbett asked on 05 Mar 2010, 09:15 PM
 
        [Test]  
        public void TestGetSubmitter()  
        {  
            // Launch a browser instance  
            Manager.LaunchNewBrowser(BrowserType.InternetExplorer);  
 
            // The active browser  
            ActiveBrowser.NavigateTo("http://localhost/ESubmissions/GetSubmitterInfo.aspx");  
            Assert.IsTrue(ActiveBrowser.ContainsText("Please provide the following information so that we may contact you regarding your electronic submission."));  
 
            var input = Find.ByCustom<RadTextBox>(e => e.ID.Contains("SubFirstName_wrapper"));  
            Assert.AreEqual("First Name", input.EmptyMessage);  
 
            input.TypeText("Daniel", 100);  
            input.Blur();  
 
            Assert.AreEqual("Daniel", input.InputValue );  
        } 

I am trying to set a bunch of fields on this form to automate testing of this web application.

var input is set correctly to the right TextBox...  

The Assert.AreEqual for the EmptyMessage succeeds.

However, all that input.TypeText("Daniel", 100); does is to clear the text box.

Thus the last AreEqual fails because InputValue is the empty string.

Ideas?

FYI, My Asp.net page has::

                                        <td class="formBkgrnd submitterFormLeft" style="margin-left: 80px">  
                                            <telerik:RadTextBox ID="SubFirstName" runat="server" EmptyMessage="First Name" MaxLength='<%$ MaxLength:Contact.FirstName %>' 
                                                TabIndex="11" CssClass="formText">  
                                            </telerik:RadTextBox> 
                                        </td> 

and the HTML rendered is:

 <span id="ctl00_content_SubFirstName_wrapper" class="RadInput RadInput_Default" style="white-space:nowrap;"><input value="First Name" type="text" maxlength="50" size="20" id="ctl00_content_SubFirstName_text" name="ctl00_content_SubFirstName_text" class="riTextBox riEmpty formText" tabindex="11" style="width:125px;" /><input id="ctl00_content_SubFirstName" name="ctl00$content$SubFirstName" class="rdfd_" style="visibility:hidden;margin:-18px 0 0 -1px;width:1px;height:1px;overflow:hidden;border:0;padding:0;" type="text" value="" /><input id="ctl00_content_SubFirstName_ClientState" name="ctl00_content_SubFirstName_ClientState" type="hidden" /></span>  
 

7 Answers, 1 is accepted

Sort by
0
Missing User
answered on 05 Mar 2010, 09:49 PM
Hi Daniel,

Is there a text cursor in the RadInput when TypeText is called? If not or if the RadInput does not have focus, please try clicking on the RadInput first before doing the TypeText, which should be either a input.Click() or input.MouseClick() call.

Greetings,
Nelson Sin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Daniel Corbett
Top achievements
Rank 1
answered on 05 Mar 2010, 10:59 PM
I tried that...  both Click() and MouseClick(), and using both "SubfirstName" and "SubFirstName_wrapper".   Nothing seems to work.

The click does put a cursor on the browser, nothing seems to go into the field.  :-(

The current version of my code...

 [Test]  
        public void TestGetSubmitter()  
        {  
            // Launch a browser instance  
            Manager.LaunchNewBrowser(BrowserType.InternetExplorer);  
 
            // The active browser  
            ActiveBrowser.NavigateTo("http://localhost/ESubmissions/GetSubmitterInfo.aspx");  
            Assert.IsTrue(ActiveBrowser.ContainsText("Please provide the following information so that we may contact you regarding your electronic submission."));  
 
            var input = Find.ByCustom<RadTextBox>(e => e.ID.Contains("SubFirstName"));  
            Assert.AreEqual("First Name", input.EmptyMessage);  
 
            input.Click();  
            input.TypeText("Daniel", 100);  
 
            var input2 = Find.ById<RadTextBox>("~SubLastName");  
            Assert.IsNotNull(input2);  
            Assert.AreEqual("Last Name", input2.EmptyMessage);  
 
            input2.Click();  
            input2.TypeText("Cor");  
 
            Assert.AreEqual("Daniel", input.InputValue);  
            Assert.AreEqual("Cor",input2.InputValue);  
        } 


   - Daniel
0
Konstantin Petkov
Telerik team
answered on 05 Mar 2010, 11:22 PM
Hello Daniel,

As part of the framework distribution we provide SampleTests project to demonstrate the use of the RadControls WebAii Wrappers. I just load the RadTextBox tests to get the following test typing into a RadTextBox control:

[TestMethod]
public void SingleLineTextBox()
{
    Manager.LaunchNewBrowser();
    ActiveBrowser.NavigateTo("/input/examples/radtextbox/firstlook/defaultcs.aspx");
 
    RadTextBox textBox = Find.ById<RadTextBox>("RadTextBox1_wrapper");
 
    Assert.AreEqual("type here", textBox.EmptyMessage);
 
    // simulate typing
    textBox.TypeText("some text", 100);
    textBox.Blur();
 
    Assert.AreEqual("some text", textBox.InputValue);
}

That test is actually running against the ASP.NET AJAX live demo:

http://demos.telerik.com/aspnet-ajax-beta/input/examples/radtextbox/firstlook/defaultcs.aspx

Some clarifying questions:
  1. Can you try that against that same live demo to compare whether it behaves correctly there?
  2. Can you share what version of RadControls is your application under test running?
  3. Does that fail under Firefox as well?
  4. Is there a live page we can observe the problem on and help you resolve that?

Regards,
Konstantin Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Daniel Corbett
Top achievements
Rank 1
answered on 05 Mar 2010, 11:44 PM
I copied your sample code, modified it NUnit ([Test] instead of [Testmethod]), and I used the full URl instead of the relative URL.

I got a similar result as with my code, textBox.InputValue reuturns an empty string..

Testing further with my code, I was able to be successful changing the value of a ComboBox by finding an item in the combo and selecting the item.

I then tried Firefox with the sample, and it works there.
I tried Firefox with my example, and a version of it works...   For some reason, this line failed in Firefox but worked fine in IE:

"Assert.IsTrue(ActiveBrowser.ContainsText("Please provide the following information so that we may contact you regarding your electronic submission."));"

My customer requirement is for the site to work with IE 6/7.   Of course I can use Firefox to test logic.

On my dev machine, it's running IE 8...    Is that browswer suppose to work with WebAii?

I have tried setting compatibility mode on/off.    Doesn't make a difference.

  - Daniel
0
Daniel Corbett
Top achievements
Rank 1
answered on 07 Mar 2010, 02:38 PM
I am continuing to have issues, even with Firefox...

1 -- The performance of comboBox.FindItemByValue(field.Val);    This takes quite a while subjectively...    There are over 200 entries in the list ( Countries )...    Is there  a better way?

2 -- TypeText() is not working even in Firefox with a RadMaskedTextBox field: 
 
            var phoneTextBox = Find.ById<RadMaskedTextBox>("~SubPhone");  
            phoneTextBox.TypeText("7035551212");  
            phoneTextBox.Blur();  
 
TypeText does nothing here.

There IS a publicly accessible development website I can point you to, but I don't want to post it here.   I can send it to you in an email.
0
Konstantin Petkov
Telerik team
answered on 08 Mar 2010, 09:38 AM
Hello Daniel,

The problems under IE8 are pretty strange as the browser is completely supported by the WebAii testing framework. I just ran the RadComboBox sample tests under IE8 and they all passed.

The ComboBox.FindItem methods should be a fast option. At least these methods do not iterate through all the items and return the target as soon as it matches the argument.

The MaskedTextBox typing might be a known issue. We will need to take a look and find a work-round for you.

Yes, it will be best if you can send to us credentials for access to the exact application under test so that we can give you the best solutions. You can submit a private support ticket with the details. Please point to this thread there as well, thank you!

Best wishes,
Konstantin Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Daniel Corbett
Top achievements
Rank 1
answered on 08 Mar 2010, 12:24 PM
RadCombo works fine in IE8, it's the TextBox's that are broken there.

I'll submit the ticket this morning, thanks.
Tags
ASP.NET AJAX WebAii RadControls
Asked by
Daniel Corbett
Top achievements
Rank 1
Answers by
Missing User
Daniel Corbett
Top achievements
Rank 1
Konstantin Petkov
Telerik team
Share this question
or