Re: [Watin-users] Getting Started.
Brought to you by:
jvmenen
|
From: <rke...@ch...> - 2015-05-02 15:38:55
|
I tried www.google.com as the code below and it worked. using (var ie = new IE("http://www.google.com/")) { TextField tf = ie.TextField(Find.ById("lst-ib")); if (tf.Exists) tf.Value = "sheep"; ie.Button(Find.ByName("btnG")).Click(); }But I noticed that with my URL part of the exception message indicates that it is looking in 'about:blank'. Maybe this has something to do with it? Kevin -----------------------------------------From: "Greg Hile" To: rke...@ch..., wat...@li... Cc: Sent: Sat, 2 May 2015 07:00:09 -0400 Subject: RE: [Watin-users] Getting Started. 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/ [1]")) { 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: ----------------------------------------- From: "Greg Hile" To: wat...@li... [2] 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... [3]] SENT: Friday, May 01, 2015 6:37 PM TO: wat...@li... [4] 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/) [5]) { 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 “ Links: ------ [1] http://bdsdev.alpha.kaplaninc.com/ [2] mailto:wat...@li... [3] mailto:rke...@ch... [4] mailto:wat...@li... [5] http://bdsdev.alpha.kaplaninc.com/) |