I recently started to study WatiN and followed the example of http://www.codeproject.com/KB/aspnet/WatiN.aspx . Unfortunately, I have a problem when he claims that a text box named "q" does not exist.
Here is my code:
[STAThread] static void Main(string[] args) { IE ie = new IE(); ie.GoTo("http://www.google.com"); TextField ietxt = ie.TextField(Find.ByName("q")); ietxt.TypeText("WatiN"); ie.Button(Find.ByValue("Google Search")).Click(); }
When it falls into the string ietxt.TypeText ("WatiN"), it gives an error: "Could not find the matching criteria INPUT (hidden) or INPUT (password) or INPUT (text) or INPUT (textarea) or TEXTAREA: attribute" name " equals "q" on google.com/(Internal exception: the item wasn 't available for 30 seconds.) "
Everyone seems to be using this example, and it is great for them. In addition, I went into the google.com source code and found exactly where it indicates that “q” is indeed the name of the search text field.
<input name="q" title="Search" class="gsfi" id="lst-ib" ....>
Does anyone know why I can get this error?
source share