Отправление файла (upload)
import org.openqa.selenium.*;
import java.net.URL;
public class SimpleFileUploadTest {
@Test
public void uploadTest() throws Exception {
WebDriver driver = new FirefoxDriver(capabilities);
driver.get("http://the-internet.herokuapp.com/upload");
WebElement upload = driver.findElement(By.id("file-upload"));
upload.sendKeys("your/path/here.file");
driver.findElement(By.id("file-submit")).click();
//make assertions here
driver.quit();
}
}DesiredCapabilities capabillities = DesiredCapabilities.firefox();
driver = new RemoteWebDriver(new URL(REMOTE_HUB_URL),capabillities);
driver.setFileDetector(new LocalFileDetector());Last updated