title: Upload file in test E2E with Protractor
body: <p>In my test, I have a button which is used to browse my disc and select a file.</p>
  
  <p>I want to use <code>function(el: WebElement)</code>, but I have an error:</p>
  
  <pre><code>import { ElementFinder, browser, by, element } from 'protractor';
  </code></pre>
  
  <blockquote>
    <p>SyntaxError: Cannot use import statement outside a module</p>
  </blockquote>
  
  <p>My code in <strong>fic_test.js</strong>:</p>
  
  <pre><code>it("Upload file",function(){
          let filePath = "../../../PJ/a.jpg";
          let fpath = path.resolve(__dirname,filePath);     
          browser.get("...");
          browser.sleep(5000);
          browser.findElement(by.xpath('//button[contains(.," Télécharger un autre document ")]')).then(function(el: WebElement){
              browser.executeScript("arguments[0].scrollIntoView(true);",el);
              el.sendKeys(fpath);
          });
  </code></pre>
  
  <p><strong>Files in my project :</strong></p>
  
  <ul>
  <li>conf/conf.js</li>
  <li>tests/fic_test.js</li>
  </ul>