小白白ss 发表于 2017-9-1 14:27:17

请教selenium3.4版本在java1.8环境下sendkeys方法报错

Selenium3.4版本,Java运行环境是1.8,工具是myeclipse
使用sendkeys方法时,报错了。报错信息:The method sendKeys(CharSequence[]) from the type WebElement refers to the missing type CharSequence
代码如下:
public class Demo04 {
    public static void main(String[] args) {
      System.out.println("1111");
      System.setProperty("webdriver.chrome.driver",
                ".\\tool\\chromedriver.exe");
      WebDriver wb = new ChromeDriver();
      wb.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
      wb.get("https://www.baidu.com");
      WebElement we = wb.findElement(By.id("kw"));
      WebElement we1 = wb.findElement(By.id("su"));
      we.sendKeys(“ceshi”);//换成wb.findElement(By.id("kw")).sendkeys(new String[]{"ceshi"});也是一样报错
      we1.click();
    }
}
说明:把运行环境换成1.7,语句是不报错了,运行时报错。提示不支持52.0(1.7版本)。
请问,有人碰到我这种情况吗?可有好的解决方案?跪求。。。

MrMirror 发表于 2017-9-6 16:22:45

亲,selenium3俺表示蛋疼。。。首先,它支持Firefox46+,Chrome53+。我给你的建议就是用回selenium2.53.6.稳定!另外就是浏览器的问题。Chrome加强了安全性,用53+Chrome做自动化,老提示那个什么鬼,老讨厌!!!还是先等一段时间再用selenium3吧

Alawn 发表于 2017-12-28 12:53:11

路过

yzmszh 发表于 2018-6-27 15:05:42

selenium3.0以上需要配置浏览器驱动了,大兄弟

lyl744455 发表于 2018-8-14 15:58:29

driver版本要和浏览器版本匹配的
页: [1]
查看完整版本: 请教selenium3.4版本在java1.8环境下sendkeys方法报错