java dispatchevent_java – selenium.click()不起作用:EventTarget.dispatchEvent的参数1没有实现接口事件...

我有下一个问题:

我尝试使用DefaultSelenium对象运行一个简单的单击,如下所示:

private DefaultSelenium seleniumClient = new DefaultSelenium("localhost", 4444, "*firefox",

"http://localhost:8080");

@When("^I try to login with user \"([^\"]*)\" and password \"([^\"]*)\"$")

public void I_try_to_login_with_user_and_password(String userName, String password) throws Throwable {

enterData("id=username", userName);

enterData("id=password",password);

seleniumClient.click("id=login");

}

private void enterData(String field, String data) throws Exception {

boolean result = seleniumClient.isElementPresent(field);

Assert.assertTrue("the field: "+ field +" was not found",result);

seleniumClient.type(field, data);

}

这是我的HTML代码:

Login

但是,当我运行此代码时,我有下一个异常:

com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the user group at https://groups.google.com/forum/#!forum/selenium-users for error details from the log window.

The error message is: Argument 1 of EventTarget.dispatchEvent does not implement interface Event.

at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:112)

at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:106)

at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:193)

at LoginSteps.I_try_to_login_with_user_and_password(LoginSteps.java:33)

at ✽.When I try to login with user "John Doe" and password "secret"(login.feature:8)

我的pom.xml文件有:

info.cukes

cucumber-picocontainer

1.1.5

test

org.seleniumhq.selenium

selenium-java

2.35.0

test

org.seleniumhq.selenium

selenium-server

2.35.0

test

任何想法:“EventTarget.dispatchEvent的参数1没有实现接口事件.”

最佳答案 我通过升级到最新版本的Selenium(2.42.2)解决了这个问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值