jqGrid, MVC3, Nunit, WatiN... need help automating a search
We are creating a new system with jqgrid as our main grid display - and we have implemented searching in the grid by using the fields in the column header. Basically the grid comes up empty and the user can click in the column over a field and type information and hit enter and the grid search fires. We are also going to use the popup form for searching - but for most grids we will use the column header type fields for searches.
I am trying to automate a test and 开发者_StackOverflow社区having a bit of trouble... I can bring up the page and enter information into the field I want to search on... but automating the enter key is giving me a little trouble.
Is there a hidden button? Or a script I need to call?
I have used; System.Windows.Forms.SendKeys.SendWait("{ENTER}"); and that works only when running the test in debug mode - looks like since the browser is brought to the front, it is aware of the current form. If I "Run" the test - and the browser comes up in the background, the enter is not sent.
I looked at; WebBrowser.Current.ActiveElement.KeyPress('\r'); but I can't get that to work.
TIA Wayne
I'm looking into the same issue right now. Having a look at NunitForms for inspiration (I know it's not the web) and it's keyboard controller in particular and the Press method in particular looks promising:
public void Press(string key)
{
keyboardControl.Focus();
sendKeys.SendWait(key);
Application.DoEvents();
}
UPDATE: Not much gained from that yet, when I next look at this I'll probably try and find a way to bring the browser to the fore. (and will update this again)
精彩评论