title: Using JavascriptExecutor to sendKeys plus click on web element
body: <p>I'm trying to open a link in a new tab, then switch to that tab, in a Firefox browser, using selenium in Java. It's my understanding that in order to do this, I need to use a send keys combination.</p>
  
  <p>In order to open the link in the same window, I've been using something like this:</p>
  
  <pre><code>WebElement we = driver.findElement(By.xpath("//*[@id='btn']"));
  
  JavascriptExecutor executor = (JavascriptExecutor) driver;
  executor.executeScript("arguments[0].click();", we);
  </code></pre>
  
  <p>The above was working fine for me. </p>
  
  <p>Now I'm trying to also sendKeys, as in below, which is not working:</p>
  
  <pre><code>JavascriptExecutor executor = (JavascriptExecutor) driver;
  executor.executeScript("keyDown(Keys.CONTROL)
                          .keyDown(Keys.SHIFT)
                          .click(arguments[0])
                          .keyUp(Keys.CONTROL)
                          .keyUp(Keys.SHIFT);", we);
  </code></pre>
  
  <p>Any advice? I can't figure out the correct syntax to sendKeys to JavascriptExecutor. I've seen some similar solutions using Actions, but this hasn't worked for me either.</p>