WatiN pressTab doesn't press tab

放肆的年华 提交于 2019-12-08 02:25:10

问题


Has anyone found a means to press tab with watiN in Internet explorer?


回答1:


Do you mean you want to press the tab key itself, or just click on an HTML element that looks like a tab? For the latter use the Click method against the appropriate element (Div, Span etc). Otherwise you could try SendKeys instead of PressTab. e.g.:

IE ie = new IE("http://www.google.com");
ie.AutoClose = false;
ie.TextField(Find.ByName("q")).Click();
SendKeys.SendWait("{TAB}");

The above example will set the focus the text field then tab off, putting focus on the search button.




回答2:


we had the same problem, we resolve it focusin on the browser and using SendMessage (Win) to the specific hwnd.



来源:https://stackoverflow.com/questions/1539873/watin-presstab-doesnt-press-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!