@@ -0,0 +1,1498 @@
+import org.apache.http.HttpResponse;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.client.methods.HttpGet;%0Aimport org.apache.http.impl.client.HttpClientBuilder;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.openqa.selenium.By;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.firefox.FirefoxDriver;%0A%0Aimport java.io.IOException;%0A%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.Matchers.greaterThan;%0Aimport static org.hamcrest.Matchers.is;%0A%0Apublic class DownloadFileRevisited %7B%0A    WebDriver driver;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        driver = new FirefoxDriver();%0A    %7D%0A%0A    @Test%0A    public void dropdownTest() throws IOException %7B%0A        driver.get(%22http://the-internet.herokuapp.com/download%22);%0A        String link = driver.findElement(By.cssSelector(%22.example a:nth-of-type(2)%22)).getAttribute(%22href%22);%0A%0A        HttpClient httpClient = HttpClientBuilder.create().build();%0A        HttpGet request = new HttpGet(link);%0A        HttpResponse response = httpClient.execute(request);%0A        String contentType = response.getFirstHeader(%22Content-Type%22).getValue();%0A        int contentLength = Integer.parseInt(response.getFirstHeader(%22Content-Length%22).getValue());%0A%0A        assertThat(contentType, is(%22application/pdf%22));%0A        assertThat(contentLength, greaterThan(0));%0A    %7D%0A%0A    @After%0A    public void tearDown() throws Exception %7B%0A        driver.quit();%0A    %7D%0A%7D

add download a file revisited Java example