title: how to change file download location in Webdriver while using chrome driver/firefox driver
body: <p>I am trying to save an image by using save as option inside a specific folder. I found a way by which I am able to right click on the image which I want to save using save as option. But the problem where I am stuck is after getting the os window which asks where to save the file I am not able to send the desired location because I don't know how to do it. I went through the similar questions asked on this forum but non of them helped so far.</p>
  
  <p>Code is-</p>
  
  <p>For Firefox-</p>
  
  <pre><code>public class practice {
  
   public void pic() throws AWTException{
       WebDriver driver;
  
       //Proxy Setting     
          FirefoxProfile profile = new FirefoxProfile();
          profile.setAssumeUntrustedCertificateIssuer(false);
          profile.setEnableNativeEvents(false);
          profile.setPreference("network.proxy.type", 1);
          profile.setPreference("network.proxy.http", "localHost");
          profile.setPreference("newtwork.proxy.http_port",3128);
  
          //Download setting
          profile.setPreference("browser.download.folderlist", 2);
          profile.setPreference("browser.helperapps.neverAsk.saveToDisk","jpeg");
          profile.setPreference("browser.download.dir", "C:\\Users\\Admin\\Desktop\\ScreenShot\\pic.jpeg");
          driver = new FirefoxDriver(profile);
  
          driver.navigate().to("http://stackoverflow.com/users/2675355/shantanu");
          driver.findElement(By.xpath("//*[@id='large-user-info']/div[1]/div[1]/a/div/img"));
          Actions action = new Actions(driver);
          action.moveToElement(driver.findElement(By.xpath("//*[@id='large-user-info']/div[1]/div[1]/a/div/img"))).perform();
          action.contextClick().perform();
          Robot robo = new Robot();
          robo.keyPress(KeyEvent.VK_V);
          robo.keyRelease(KeyEvent.VK_V);
      // Here I am getting the os window but don't know how to send the desired location
      }//method   
  }//class
  </code></pre>
  
  <p>For chrome- </p>
  
  <pre><code>public class practice {
     public void s() throws AWTException{
          WebDriver driver;   
          System.setProperty("webdriver.chrome.driver","C:\\Users\\Admin\\Desktop\\chromedriver.exe");
          driver = new ChromeDriver();
          driver.navigate().to("http://stackoverflow.com/users/2675355/shantanu");
          driver.findElement(By.xpath("//*[@id='large-user-info']/div[1]/div[1]/a/div/img"));
          Actions action = new Actions(driver);
          action.moveToElement(driver.findElement(By.xpath("//*[@id='large-user-info']/div[1]/div[1]/a/div/img"))).perform();
          action.contextClick().perform();
          Robot robo = new Robot();
          robo.keyPress(KeyEvent.VK_V);
          robo.keyRelease(KeyEvent.VK_V);
          // Here I am getting the os window but don't know how to send the desired location
     }
   }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Z06Iu.jpg" alt="This is the pop up window where I am stuck"></p>