2018-02-06 chromeDriver sendkeys
2018-02-06 本文已影响0人
3f33f6b95f47
测试qq邮箱发件用例时,收件人一框的元素能够找到并click,但是sendkeys一直报错,后来网上找到一个方法:
Actions actions = new Actions(driver);
actions.moveToElement(sendMan);
actions.click();
actions.sendKeys("username@126.com");
actions.build().perform();
故将其抽象为Page类的方法,其自类均可调用,
public static void actionSendKays (WebDriver driver,WebElement
webelement,String senkeys) {
Actions actions = new Actions(driver);
actions.moveToElement(webelement);
actions.click();
actions.sendKeys(senkeys);
actions.build().perform();
}