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.
9 Answers, 1 is accepted
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();
ActiveBrowser.NavigateTo(
"http://www.dotnetfunda.com/tutorials/controls/login.aspx"
);
Find.ById<HtmlTable>(
"PlaceHolderForContents_Login1"
).ScrollToVisible();
Find.ById<HtmlInputText>(
"PlaceHolderForContents_Login1_UserName"
).Text =
"test"
;
Find.ById<HtmlInputPassword>(
"PlaceHolderForContents_Login1_Password"
).Text =
"tester"
;
}
Anthony
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
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
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?
Anthony
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
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.
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.
Anthony
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
127.0.0.1 localhost localhost.telerik.com
Couple of things I have noticed:
If this call:
Settings settings = GetSettings();I have attached a solution that highlights the problems I am having.
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.
Thank you.
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"
);
Anthony
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
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.
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.
Anthony
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.