Selenium Webdriver sendkeys不会在IE9.0中触发onchange事件 [英] Selenium Webdriver sendkeys does not trigger onchange event in IE9.0

查看:70
本文介绍了Selenium Webdriver sendkeys不会在IE9.0中触发onchange事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java为ExtJs中内置的应用程序编写Selenium测试脚本.我在页面之一上有一个输入字段,该页面附加到"onchange"事件上.每当用户修改字段中的文本时,就会触发onchange事件.我正在使用WebDriver sendKeys()修改字段中的文本.因此,每当修改文本时,"onchange"事件都会在Firefox和Chrome中触发(如预期的那样),但不会在IE9.0中触发.我已经在网上搜索了所有解决方案,但没有找到解决方案.所以,有人可以帮我吗?让我知道需要更多信息

I'm writing Selenium test scripts using Java for an application built in ExtJs. I have an input field in one of the page which is attached to 'onchange' event. Whenever user modifies the text in the field, onchange event is triggered. I'm using WebDriver sendKeys() to modify the text in the field. So whenever text is modified, 'onchange' event is triggered in Firefox and Chrome (as expected) but its not getting triggered in IE9.0. I have searched all over the net for the solution, but didn't find one. So please can someone help me on this? Let me know more info is required

推荐答案

您可以单击字段上的其他元素,或者更简单的方法是在输入完成后从字段中跳出.

You can either click on a different element on the field, or perhaps the easier way is to tab off of the field after the input is finished.

在我自动化的ExtJS应用程序中,执行输入后,我总是会跳出该字段,这会触发所有正确的事件.

In the ExtJS applications I've automated, I'll always tab off of the field after performing the input, which fires all of the correct events.

以C#为例:

IWebElement element = driver.FindElement(By.Id("some_input_field"));
element.SendKeys("test input")
element.SendKeys(Keys.Tab);

这篇关于Selenium Webdriver sendkeys不会在IE9.0中触发onchange事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆