Q:

Upload file using selenium web driver

I have already check and search for same question and  there are lot of solution but no one is working for me so posing question here.
I am doing practice of selenium web driver. I am using this form for practice : http://www.toolsqa.com/automation-practice-form/
Now , I have 3 issues in that. 
1 - There are first 2 links called "Partial link test" & "List test" which I am able to click on, using "findelement", but I want to open both link in NEW TAB in same browser.
2 - I am not able to upload file. My code is not working for that element.
3 - How can I select particular value from dropdown of "Continents"??
My code is given below :
    WebDriver driver = new FirefoxDriver();

    driver.get("http://www.toolsqa.com/automation-practice-form/");

    driver.manage().window().maximize();

    **driver.findElement(By.linkText("Partial Link Test")).click();
    driver.findElement(By.linkText("Link Test")).click();**

    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.name("firstname")).sendKeys("Tester");
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.name("lastname")).sendKeys("Tester");
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.id("sex-0")).click();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.id("exp-2")).click();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.id("datepicker")).sendKeys("01/01/1985");
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.findElement(By.id("profession-1")).click();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

   **driver.findElement(By.id("photo")).sendKeys("C:/Users/Public/Pictures/Sample Pictures/Desert.jpeg");**
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   Thread.sleep(600);

   driver.findElement(By.id("tool-0")).click();
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
   **driver.findElement(By.id("continents")).click();**
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

Please help to correct my code.

A:

I have added the answers inline to each of your questions, below. Also, an advice, is to use Implicit wait only once at the top while creating a browser instance, as its scope is the whole class itself. So, once declared, then selenium will wait a maximum of that time, for detecting an element. It can be rather overridden by using Explicit waits for certain elements, if necessary Please see this link for better understanding Implicit and Explicit waits:
1 - There are first 2 links called "Partial link test" & "List test" which I am able to click on, using "findelement", but I want to open both link in NEW TAB in same browser.
    //Clicking and opening Partial Link Text in new tab
    WebElement element = driver.findElement(By.linkText("Partial Link Test"));
    Actions act = new Actions(driver);
    act.contextClick(element).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();

    //Clicking and opening Link Text in new tab
    element = driver.findElement(By.linkText("Link Test"));
    act.contextClick(element).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();

2 - I am not able to upload file. My code is not working for that element. 
The path of the  file must be like this:
driver.findElement(By.id("photo")).sendKeys("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg");

3 - How can I select particular value from dropdown of "Continents"??
You can use Select class for that like below. It will select the option "Australia".
Select sel = new Select(driver.findElement(By.id("continents")));
sel.selectByVisibleText("Australia");

