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

  • Post author:
  • Post category:其他


代码: 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中的内容换成上面的内容。



版权声明:本文为songsallyjin原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。