Re: [Watin-users] Getting Started.
Brought to you by:
jvmenen
|
From: Greg H. <gh...@qu...> - 2015-05-02 11:00:37
|
Do the same code for Google.com and see what your results are there. If it works for google.com, then . . . What version of IE is it? Try in compatibility mode. Also if you are running the application as admin you may want to make sure protected mode is off in IE and if not running as admin maybe make sure it is on. From: rke...@ch... [mailto:rke...@ch...] Sent: Friday, May 01, 2015 8:54 PM To: 'wat...@li...' Cc: 'gh...@qu...' Subject: Re: [Watin-users] Getting Started. Thank you for responding. Here is the complete source for what I am trying: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WatiN.Core; namespace WatiNDemo { class Program { [STAThread] static void Main(string[] args) { using (var ie = new IE("http://bdsdev.alpha.kaplaninc.com/")) { TextField tf = ie.TextField(Find.ById("Username")); if(tf.Exists) ie.TextField("Username").Value = "kburton"; ie.TextField("Password").Value = "July231951Kaplan"; ie.Button("login").Click(); } } } } The 'Exists' is always false. So I don't get the exception but nothing happens. The web page is staightforward. It is not in a frame. Using the browser debugger the source of this element looks like: <input name="Username" id="Username" type="text" value="" data-val-required="A username is required to log in." data-val-length-min="3" data-val-length-max="40" data-val-length="Invalid Username" data-val="true"> ----------------------------------------- From: "Greg Hile" To: wat...@li... <mailto:wat...@li...> Cc: Sent: Fri, 1 May 2015 20:26:46 -0400 Subject: Re: [Watin-users] Getting Started. Try something like. . . TextField tf = ie.TextField(Find.ById(“Username”)); If(tf.exists) { tf.Value = “mystuff”; } If it does not exist, then check if it is in a frame or if it’s input type I not set to a typical type. From: Kevin Burton [mailto:rke...@ch...] Sent: Friday, May 01, 2015 6:37 PM To: wat...@li... <mailto:wat...@li...> Subject: [Watin-users] Getting Started. I have a very simple startup application. It is a Windows Console app that looks like: Class Program { [STAThread] static void Main(string[] args) { using(var ie = new IE(http://bdsdev.alpha.kaplaninc.com/)) { ie.TextField(“Username”).Value = “xxxxxxx”; ie.TextField(“Password”).Value = “yyyyyyyy”; ie.Button(“login”).Click(); } } } The web page is a very simple web page with two input fields and a submit button. I have checked that the web page has something like “<input id=’<id>’ . . . . .” for the two fields. In other words the fields do have ids. But when I run this simple code I get a timeout exception indicating that the field “Username” could not be found (WatiN.Core.Exceptions.ElementNotFoundException Could not find INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA element tag matching criteria: Attribute ‘id’ equals ‘Username’ at about:blank.) First I know the web page that appears as a result of the IE constructor has an input field with id of ‘Username’. Second the exception indicates ‘about:blank’. This is not the URL that it should be looking for the field in. Ideas? Thank you. |