Re: [Watin-users] Getting Started.
Brought to you by:
jvmenen
|
From: Greg H. <gh...@qu...> - 2015-05-02 00:39:47
|
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...
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.
|