Password TextBox Problem

10 posts, 0 answers
  1. Pouya
    Pouya avatar
    6 posts
    Member since:
    Mar 2011

    Posted 01 Dec 2011 Link to this post

    Using the AspNet browser, I am able to grab both the UserName and Password TextBoxes. I insert my username and attempt to insert my password and click the Login button. This fails.
    I dump the source and only see that the Username Textbox is populated.
    The UserName and Password textbox are located within an ASP:Login control.
    Any suggestions?
    This is the first step before I test the rest of my application and need a way to log into the system.
    Thank you.
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 05 Dec 2011 Link to this post

    Hi Pouya,

    I suspect you are identifying the password field as a regular input text field, and not an input password field. This code worked for me:

    [TestMethod]
    public void AspLoginControl()
    {
     Manager.LaunchNewBrowser();
     
     Find.ById<HtmlTable>("PlaceHolderForContents_Login1").ScrollToVisible();
     Find.ById<HtmlInputText>("PlaceHolderForContents_Login1_UserName").Text = "test";
     Find.ById<HtmlInputPassword>("PlaceHolderForContents_Login1_Password").Text = "tester";
         
    }
     

    Regards,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Pouya
    Pouya avatar
    6 posts
    Member since:
    Mar 2011

    Posted 06 Dec 2011 Link to this post

    In my test, after I get the password textbox element and attempt to set a password, this occurs:

    DialogPlayback: DialogMonitor.Start() : Beginning monitoring for dialogs from the set {}.
    UIAutomation: AutomationExtensions.AddAutomationEventHandler() : Added a(n) WindowPatternIdentifiers.WindowOpenedProperty handler on element System.Windows.Automation.AutomationElement scope Descendants.
    Framework: Manager.get_ActiveBrowser() : The current ActiveBrowser is either invisible or disconnected.
    Framework: Manager.AddNewBrowser() : Added client ID "Client_2a892b5e-f61c-492e-b9e0-d153648fcbf5" (now there is/are 1 total).
    Framework: BrowserProvisioner.EndService() : Connecting to the provisioning pipe "Pipe.ArtOfTest.WebAii.BrowserProvisioner" in order to unblock and eventually terminate it...
    Framework: BrowserProvisioner.EndService() : Provisioning pipe connected.
    Framework: BrowserProvisioner.ServiceThread() : A new client has connected to the provisioning pipe but this will be treated as a termination cue.
    Framework: BrowserProvisioner.EndService() : Provisioning thread terminated.
    DialogPlayback: DialogMonitor.Stop() : Dialog monitoring is being halted.

    Demonstrate performing automation actions against Asp.Net in Proc Host.: ArtOfTest.WebAii.Exceptions.UnsupportedBrowserOperationException : Browser type 'AspNetHost' does not support the following operation: 'InvokeScript'

    at ArtOfTest.WebAii.BrowserSpecialized.AspNetHost.AspNetHostActions.InvokeScript(String script)
    at ArtOfTest.WebAii.ObjectModel.Element.SetValue(String propertyName, T value)
    at ArtOfTest.WebAii.Controls.HtmlControls.HtmlInputControl.set_Value(String value)
    at ArtOfTest.WebAii.Controls.HtmlControls.HtmlInputPassword.set_Text(String value)
    at QuickStarts_NUnit_CS.AspNetInProcHost2.AspNetInProcTesting() in AspNetInProcHost2.cs: line 161

  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 06 Dec 2011 Link to this post

    Hello Pouya,

    Is your test against a publicly accessible site? Please provide the full code; we'd like to see the issue first-hand. 

    Does the sample test I provided work for you?

    All the best,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Pouya
    Pouya avatar
    6 posts
    Member since:
    Mar 2011

    Posted 13 Dec 2011 Link to this post

    I have attached a zip with the Login.aspx page and the test.
    There are a couple issues:
    1) Line 42:  Manager.LaunchNewBrowser();
      -- This actually launches a Internet Explorer browser.
    2) Line 50: Find.ById<HtmlTable>("Content_Login1").ScrollToVisible();
      -- Exception: Browser type 'AspNetHost' does not support the following operation: 'ExecuteCommand'
    
    If I comment out line 50.
    
    3) Line 58: _userpasswordTextbox.Text = "Password!123";
    -- Exception: Browser type 'AspNetHost' does not support the following operation: 'InvokeScript' I need to be able to set the password and click the login button in order to test any of my later pages.
  6. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 13 Dec 2011 Link to this post

    Hi Pouya,

    Unfortunately I am unable to load the page or run the test with just the two files you provided. I'll need a complete, running project to load it and test it locally just as you are.

    The sample test I included is intended to be run against a public site by launching a new instance of Internet Explorer. Getting started with Telerik Testing Framework in this context is explained here

    Regards,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Pouya
    Pouya avatar
    6 posts
    Member since:
    Mar 2011

    Posted 15 Dec 2011 Link to this post

    First, update your hosts file (c:\Windows\System32\drivers\etc\hosts) and add the following line (this will make your development environment similar to ours):
    127.0.0.1      localhost localhost.telerik.com

    Couple of things I have noticed:
    If this call:
    Settings settings = GetSettings(); 
    Retrieves the settings from my config file, then setting the DefaultBrowser:
    settings.Web.DefaultBrowser = BrowserType.AspNetHost;
    
    Will not work and on
    Manager.LaunchNewBrowser();
    
    a visible instance of IE is launched.
    If the call
    Settings settings = GetSettings(); 
    Retrieves the default settings, then all the subsequent calls leading up to 
    Manager.LaunchNewBrowser();
    Work as expected and an invisible AspNetHost browser is launched.

    I have attached a solution that highlights the problems I am having.

    Thank you.
  8. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 16 Dec 2011 Link to this post

    Hi Pouya,

    Thank you for the project. I was able to reproduce the error.

    First, the ScrollToVisible() will not work in your AspNetHostBrowser test because no browser window is launched to be scrolled. I included that step in my original sample code for an ActiveBrowser test against a live web page.

    Second, the error received from the _userpasswordTextbox.Text line is a bug. I filed a report for it and you can find the PITS Issue here: Public URL.

    In the meantime, replace that line with the following code:

    //_userpasswordTextbox.Text = "Password!123";
    Actions.SetText(_userpasswordTextbox.BaseElement, "Password!123");
     

    Greetings,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Pouya
    Pouya avatar
    6 posts
    Member since:
    Mar 2011

    Posted 21 Dec 2011 Link to this post

    Anthony,
    I'm glad that I helped identify an issue. But, at this point, your suggestion is still not inserting a password into that text box.
    Do you have any other suggestions?

    Thank you. 
  10. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 21 Dec 2011 Link to this post

    Hi Pouya,

    That is puzzling. As you can see in the following screen recording, that line works for me in your project:

    http://screencast.com/t/s8zlC5Ra

    What error are you receiving? What line in the code does it reference?

    Unfortunately the bug I filed has not been updated, so I cannot provide an ETA on when the fix will be implemented. 

    Does this need to be an AspNetHostBrowser test? You can adapt the code into an ActiveBrowser test that launches a browser window and interacts against the live web page. You should then be able to input text into the password field with the original line of code.

    Kind regards,
    Anthony
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top