9
4

1 回答 1

4

尝试先显示控件,然后设置值,然后再次隐藏它:

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('image-selector-button').style.display = 'block';");
driver.findElement(By.id("image-selector-button ")).sendKeys("c:\\myFile.bmp");
js.executeScript("document.getElementById('image-selector-button').style.display = 'none';");
于 2013-03-11T16:36:10.120 回答