First of all, When I opened the link (`http://gmail.com`) I found this page.

[Google Home Page][1]

>Before performing any actions you need **to click `SIGN IN` button**.

**Element :** 

LinkText =  `Sign In`

 **OR**

   LinkText = `SIGN IN`

**OR**

   css = `a[class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']` 

**OR**

  xpath = `//a[@class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']`

---

>Code should be like this from line num **`38`** :

     wd.get(url);
     wd.findElement(By.xpath("//a[@class='gmail-nav__nav-link gmail-nav__nav-link__sign-in']")).click();
     Thread.sleep(2000); // remove this after your code get run properly
     WebElement loginName = wd.findElement(By.name("identifier"));

[Sign In Page][2]

>After clicking on `SIGN IN`, browser will open this page and you can run your remain code.


  [1]: http://prntscr.com/ibby69
  [2]: http://prntscr.com/ibc4g6