tags:

views:

1436

answers:

1

Hi

I'm using WatiN testing tool. can i pass a key stroke (i.e., pressing a enter key) to the application using WatiN scripts, this option was availabel in WatiR. Is this option available in WatiN? please suggest some solution to this problem.

thanking you

+2  A: 

EDIT: Upon further inspection, I found that the standard way of sending the ENTER key doesn't work in WatiN as it does in WatiR. You need to use System.Windows.Forms.SendKeys

Also, I recommend that you download the WatiN Test Recorder.

Here's the sample code.

using(IE ie = new IE("http://someurl"))
{
  TextField myTxt = ie.TextField(Find.ById("myTextBox")).TypeText("some value");
  System.Windows.Forms.SendKeys.SendWait("{ENTER}");      
}
Jose Basilio
This doesn't appear to work either.
Dmitri Nesteruk