Class Upload

All Implemented Interfaces:
Composable, MultiPhased

public class Upload extends MultiPhaseAction
Upload is a subclass of MultiPhaseAction which types path of file into the file upload element. StaleElementReferenceException may happen while Select tries to manipulate the element, so multi-phase is used to perform the action again.

Upload needs to make the file upload element visible first, so below javascript will be executed before typing into it:

 fileUploadElement.style.display = 'inline-block';
 fileUploadElement.style.visibility = 'visible';
 fileUploadElement.style.height = '1px';
 fileUploadElement.style.width = '1px';
 fileUploadElement.style.opacity = 1;
 
Author:
Kimberly
  • Constructor Details

    • Upload

      public Upload(org.openqa.selenium.By by, String... pathOfFiles)
      Create an action to perform file uploads.
      Parameters:
      by - the element locating mechanism
      pathOfFiles - the paths of files to upload
    • Upload

      public Upload(org.openqa.selenium.By by, List<org.openqa.selenium.By> frameBySequence, String... pathOfFiles)
      Create an action to perform file uploads.
      Parameters:
      by - the element locating mechanism
      frameBySequence - the sequence of the frame locating mechanism for the element resides in frame(or frame in another frame and so on)
      pathOfFiles - the paths of files to upload
  • Method Details