title: Serenity screenplay pattern- upload file
body: <p>We are trying cucumber serenity framework for end to end tests. I am fairly new the technology and I tired this simple code below.</p>
  
  <pre><code>actor.attemptsTo(Enter.theValue(path).into(Upload));
  </code></pre>
  
  <p>where path is the location of file i am trying to upload using browser's upload widget.Has anyone ever managed to perform actions like this using serenity screen play pattern.</p>
  
  <p>Its really making us think of giving up serenity and just use cucumber-selenium framework as I can easily perform this using Upload.sendkeys(path);
  Any help is much appreciated. Thanks in advance.</p>
  
  <p><a href="https://i.stack.imgur.com/fjFup.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fjFup.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/pG32z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pG32z.png" alt="enter image description here"></a></p>
  
  <p><strong>AS requested: Listing Steps:</strong></p>
  
  <pre><code>public class ListingSteps
  {
    @Before
    public void set_the_stage() {
      OnStage.setTheStage(new OnlineCast());
    }
  
    @Given("^(.*) is able to click import products$") public void userIsAbleToClick(String actorName) throws Throwable
    {
      theActorCalled(actorName).wasAbleTo(Start.theApplication());
  
    }
    @When("^s?he imports a  single item successfully$") public void heImportsASingleItemSuccessfully() throws Throwable
    {
      theActorInTheSpotlight().attemptsTo(Import.spreadsheet());
    }
    @Then("^(.*) are listed on ebay and amazon with all the right information$") public void itemsAreListedOnEbayAndAmazonWithAllTheRightInformation(String actorName, String SKU)
       throws Throwable
  </code></pre>
  
  <p>{
  //pending</p>
  
  <pre><code>  }
  </code></pre>
  
  <p>Ignore then for now as its work in progress. </p>
  
  <p><strong>Import class:</strong></p>
  
  <pre><code>public class Import implements Task
  {
    protected String path =
        "C:\\somePathToFile\\populated_excel.xlsx";
    public static Import spreadsheet()
    {
      return instrumented(Import.class);
    }
    @Override public &lt;T extends Actor&gt; void performAs(T actorName)
    {
      actorName.attemptsTo(Click.on(Products.ProductsScreen));
      actorName.attemptsTo(Click.on(Products.Upload));
      actorName.attemptsTo(Enter.theValue(path).into(Browse).thenHit(Keys.RETURN));//this is the line which is giving errors
      actorName.attemptsTo(Click.on(Products.UploadButton));
    }
  }
  </code></pre>
  
  <p><strong>Target Browse</strong></p>
  
  <pre><code>public class Products
  {
   public static Target Browse = Target.the("browse file").locatedBy("//input[@type='file']");
  }
  </code></pre>