Class UploadElement
- java.lang.Object
-
- com.vaadin.testbench.TestBenchElement
-
- com.vaadin.flow.component.upload.testbench.UploadElement
-
- All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots,com.vaadin.testbench.HasCallFunction,com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasElementQuery,com.vaadin.testbench.HasPropertySettersGetters,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsElement
public class UploadElement extends com.vaadin.testbench.TestBenchElementA TestBench element representing a<vaadin-upload>element.
-
-
Constructor Summary
Constructors Constructor Description UploadElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Aborts any upload currently in progress.intgetMaxFiles()Gets how many files can be uploaded.booleanisMaxFilesReached()Checks whether the maximum number of files has been uploaded.voidupload(File file)Uploads the given local file and waits for 60s for the upload to finish.voidupload(File file, int maxSeconds)Uploads the given local file and waits for the given number of seconds for the upload to finish.voiduploadMultiple(List<File> files, int maxSeconds)Uploads the given local files and waits for the given number of seconds for the upload to finish.-
Methods inherited from class com.vaadin.testbench.TestBenchElement
callFunction, clear, click, click, compareScreen, compareScreen, compareScreen, contextClick, dispatchEvent, dispatchEvent, doubleClick, equals, executeScript, findElement, findElements, focus, getAttribute, getCapabilities, getChildren, getClassNames, getCommandExecutor, getContext, getCssValue, getDriver, getId, getLocation, getParent, getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, hover, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isReadOnly, isSelected, scroll, scrollIntoView, scrollLeft, sendKeys, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
-
-
-
-
Method Detail
-
upload
public void upload(File file)
Uploads the given local file and waits for 60s for the upload to finish.Note that Safari webdriver does not support file uploads.
- Parameters:
file- a reference to the local file to upload
-
upload
public void upload(File file, int maxSeconds)
Uploads the given local file and waits for the given number of seconds for the upload to finish.Note that Safari webdriver does not support file uploads.
- Parameters:
file- the local file to uploadmaxSeconds- the number of seconds to wait for the upload to finish or0not to wait
-
uploadMultiple
public void uploadMultiple(List<File> files, int maxSeconds)
Uploads the given local files and waits for the given number of seconds for the upload to finish.Note that Safari webdriver does not support file uploads.
Technically this temporarily disables the auto-upload feature, schedules all files for upload, and then starts the upload manually. This is necessary, because when running tests locally, uploads can finish even before we can schedule the command through the Selenium API.
- Parameters:
files- the local files to upload, can reference the same file multiple timesmaxSeconds- the number of seconds to wait for the upload to finish or0not to wait
-
getMaxFiles
public int getMaxFiles()
Gets how many files can be uploaded.- Returns:
- the number of files which can be uploaded
-
isMaxFilesReached
public boolean isMaxFilesReached()
Checks whether the maximum number of files has been uploaded.- Returns:
trueif no more files can be uploaded,falseotherwise
-
abort
public void abort()
Aborts any upload currently in progress.
-
-