在使用sendkeys()时出现的问题

来源:互联网 发布:毒丸计划 白衣骑士知乎 编辑:程序博客网 时间:2024/06/04 20:09

代码: driver.findElement(By.id("kw")).sendKeys("123");

出现的这个问题:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The method sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)

    at selenium22.T1.main(T1.java:24)

解决方法
searchField.sendKeys(new String[] { "sample" });
将sendKeys中的内容换成上面的内容。
0 0
原创粉丝点击