title: Unable to interact with Instagram login fields
body: <p>I'm having trouble interacting with the <a href="https://www.instagram.com/accounts/login/" rel="nofollow noreferrer">Instagram login page</a> using Java Selenium. I've tried using <code>Actions</code> like this:</p>
  
  <pre><code>WebDriver driver = new SafariDriver();
  driver.get("https://www.instagram.com/accounts/login/");
  WebElement login_elem = driver.findElement(By.name("username"));
  WebElement pw_elem = driver.findElement(By.name("password"));
  
  Actions action = new Actions(driver);
  action.moveToElement(login_elem).click();//Also tried this with a 'moveByOffset()'
  action.sendKeys(username);
  action.moveToElement(pw_elem).click();
  action.sendKeys(password);
  action.perform();//nothing happens
  
  WebElement element = driver.findElement(By.className("_t38eb _ov9ai")).findElement(By.tagName("button"));//element isn't visible
  element.click();//Element isn't visible
  </code></pre>
  
  <p>and I've also tried using <code>ExpectedConditions</code>:</p>
  
  <pre><code>public void login( ) {
      driver  = new SafariDriver();
      driver.get("https://www.instagram.com/accounts/login/");
  
      //Element isn't visible: waitElement times out. I've checked all the parts of the xml string, and it works until the '/input' at the end
      waitElement("//*[@id='react-root']/section/main/div/article/div/div[1]/div/form/div[1]/div/div[1]/input[@class = '_ph6vk _jdqpn _o716c']",20);
      waitElement("//*[@id='react-root']/section/main/div/article/div/div[1]/div/form/div[2]/div/div[1]/input",20);
      driver.findElement(By.xpath("//*[@id='react-root']/section/main/div/article/div/div[1]/div/form/div[1]/div/div[1]/input")).sendKeys(username);
      driver.findElement(By.xpath("//*[@id='react-root']/section/main/div/article/div/div[1]/div/form/div[2]/div/div[1]/input")).sendKeys(password);
      driver.findElement(By.xpath("//*[@id='react-root']/section/main/div/article/div/div[1]/div/form/div[1]/div/div[1]/input")).sendKeys(Keys.RETURN);
      Rest(3,true);       
      driver.get("https://www.instagram.com/" + username);
  }
  
  public void waitElement(String element, int time){
      WebDriverWait wait = new WebDriverWait(driver, time);
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(element)));
  }
  
  public void Rest(int seconds, boolean msg){
      try {
          if(msg)
          Thread.sleep(seconds*1000);         
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>and it definitely doesn't work with the normal <code>findElement()</code> -> <code>sendKeys()</code>:</p>
  
  <pre><code>WebDriver driver = new SafariDriver();
  driver.get("https://www.instagram.com/accounts/login/");
  Thread.sleep(5000);//Wait for page to load
  WebElement input = driver.findElement(By.className("_ph6vk _jdqpn _o716c"));//find the text box
  input.sendKeys(username);//ElementNotVisibleException is thrown here.
  </code></pre>
  
  <p>How do I enter strings into the form fields?</p>
  
  <p>EDIT: also tried the following:</p>
  
  <pre><code>import org.openqa.selenium.safari.SafariDriver;
  import org.openqa.selenium.support.ui.ExpectedConditions;
  import org.openqa.selenium.support.ui.WebDriverWait;
  import org.openqa.selenium.By;
  import org.openqa.selenium.WebDriver;
  
  public class Test {
      public static void main(String... args) {
          WebDriver driver = new SafariDriver();
          driver.get("https://www.instagram.com/accounts/login/");
  /*line 13*/ new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input[name='username']"))).sendKeys("AlbertLiu");
      }
  }
  </code></pre>
  
  <p>Here's the error I got:</p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.cssSelector: input[name='username'] (tried for 20 second(s) with 500 milliseconds interval)
  Capabilities {applicationCacheEnabled: true, browserName: safari, cleanSession: true, cssSelectorsEnabled: true, databaseEnabled: true, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: false, nativeEvents: true, platform: MAC, platformName: MAC, rotatable: false, version: 13604.5.6, webStorageEnabled: true}
  at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:81)
  at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:271)
  at selenium.Test.main(Test.java:13)
  </code></pre>
  
  <p>Using <code>By.xpath("//input[@name='username']")</code>, I got this error:</p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //input[@name='username']] (tried for 20 second(s) with 500 milliseconds interval)
  at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:81)
  at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:271)
  at selenium.Test.main(Test.java:13)
  </code></pre>