【以下是不负责任的转载……】

在自动化测试的过程中,经常会出现这样的场景:

按住Ctrl的同时,进行单击操作,已达到多选的目的

Actions a = new Actions(driver);
a.keyDown(Keys.CONTROL).perform();
for(int i = 0;i<quantity;i++){
WebElement securityEl = securitiesList.get(i);
SeleniumUtil.scrollIntoView(driver, securityEl);
securityEl.click();
}
a.keyUp(Keys.CONTROL).perform();
04-30 11:10