Class PdfViewerElement
java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.pdfviewer.testbench.PdfViewerElement
- 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-pdf-viewer>
element.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe zoom modes that fit the pages to the viewer, seesetZoom(ZoomMode). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the title shown in the header of the viewer.intgetPage()Gets the current page, which is the page that takes up most of the visible area.intGets the number of pages in the loaded document.getSrc()Gets the URL of the document.getZoom()Gets the zoom level of the pages.booleanhasError()Checks whether the document could not be loaded.booleanChecks whether a document is being loaded.booleanChecks whether the toolbar is collapsed.voidsetZoom(double factor) Sets the zoom to a factor of the actual size of the pages, for example1for 100% and1.5for 150%.voidSets the zoom to a mode that fits the pages to the viewer.voidCollapses the toolbar if it is expanded, or expands it if it is collapsed, by clicking the header of the viewer.voidzoomIn()Zooms in to the next zoom level with the zoom in button of the toolbar.voidzoomOut()Zooms out to the previous zoom level with the zoom out button of the toolbar.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, getDomAttribute, getDomProperty, 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, scrollIntoView, scrollLeft, sendKeys, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElementsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.HasElementQuery
$, $Methods inherited from interface org.openqa.selenium.WebElement
getAccessibleName, getAriaRole
-
Constructor Details
-
PdfViewerElement
public PdfViewerElement()
-
-
Method Details
-
getSrc
Gets the URL of the document.- Returns:
- the URL of the document, or
nullif no document is set
-
getHeaderTitle
Gets the title shown in the header of the viewer.- Returns:
- the title shown in the header
-
isToolbarCollapsed
public boolean isToolbarCollapsed()Checks whether the toolbar is collapsed.- Returns:
trueif the toolbar is collapsed,falseotherwise
-
toggleToolbar
public void toggleToolbar()Collapses the toolbar if it is expanded, or expands it if it is collapsed, by clicking the header of the viewer. -
getPage
public int getPage()Gets the current page, which is the page that takes up most of the visible area.- Returns:
- the current page, starting from
1
-
getPageCount
public int getPageCount()Gets the number of pages in the loaded document.- Returns:
- the number of pages, or
0if no document is loaded
-
getZoom
Gets the zoom level of the pages.- Returns:
page-width,page-fit, or the factor of the actual size of the pages
-
setZoom
Sets the zoom to a mode that fits the pages to the viewer.- Parameters:
mode- the zoom mode
-
setZoom
public void setZoom(double factor) Sets the zoom to a factor of the actual size of the pages, for example1for 100% and1.5for 150%.- Parameters:
factor- the factor of the actual size of the pages, greater than0
-
zoomIn
public void zoomIn()Zooms in to the next zoom level with the zoom in button of the toolbar. -
zoomOut
public void zoomOut()Zooms out to the previous zoom level with the zoom out button of the toolbar. -
isLoading
public boolean isLoading()Checks whether a document is being loaded.- Returns:
trueif a document is being loaded,falseotherwise
-
hasError
public boolean hasError()Checks whether the document could not be loaded.- Returns:
trueif the document could not be loaded,falseotherwise
-