Class UploadElement
java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.upload.testbench.UploadElement
- All Implemented Interfaces:
CanCompareScreenshots
,HasCallFunction
,HasDriver
,HasElementQuery
,HasPropertySettersGetters
,HasSearchContext
,HasTestBenchCommandExecutor
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebElement
,org.openqa.selenium.WrapsElement
A TestBench element representing a
<vaadin-upload>
element.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Aborts any upload currently in progress.int
Gets how many files can be uploaded.boolean
Checks whether the maximum number of files has been uploaded.void
Uploads the given local file and waits for 60s for the upload to finish.void
Uploads the given local file and waits for the given number of seconds for the upload to finish.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.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, getClassNames, getCommandExecutor, getContext, getCssValue, getDriver, getLocation, getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, getRect, getScreenshotAs, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isSelected, scroll, scrollIntoView, scrollLeft, sendKeys, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.testbench.HasElementQuery
$, $
Methods inherited from interface org.openqa.selenium.WebElement
getAccessibleName, getAriaRole, getDomAttribute, getDomProperty, getShadowRoot
-
Constructor Details
-
UploadElement
public UploadElement()
-
-
Method Details
-
upload
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
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 or0
not to wait
-
uploadMultiple
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 or0
not 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:
true
if no more files can be uploaded,false
otherwise
-
abort
public void abort()Aborts any upload currently in progress.
-