Package org.xwiki.test.ui
Class XWikiWebDriver
- java.lang.Object
-
- org.openqa.selenium.remote.RemoteWebDriver
-
- org.xwiki.test.ui.XWikiWebDriver
-
- All Implemented Interfaces:
org.openqa.selenium.HasCapabilities
,org.openqa.selenium.interactions.Interactive
,org.openqa.selenium.JavascriptExecutor
,org.openqa.selenium.PrintsPage
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
,org.openqa.selenium.WebDriver
public class XWikiWebDriver extends org.openqa.selenium.remote.RemoteWebDriver
Wraps aWebDriver
instance and adds new APIs useful for XWiki tests.- Since:
- 7.0M2
- Version:
- $Id: 9ef5ee242767a59935095015e0a7982f1c987206 $
-
-
Constructor Summary
Constructors Constructor Description XWikiWebDriver(org.openqa.selenium.remote.RemoteWebDriver wrappedDriver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPageNotYetReloadedMarker()
Adds a marker in the DOM of the browser that will only be available until we leave or reload the current page.void
close()
org.openqa.selenium.interactions.Actions
createActions()
Utility method to build a proper instance ofActions
.void
dragAndDrop(org.openqa.selenium.WebElement source, org.openqa.selenium.WebElement target)
Utility method to perform a drag & drop by using the appropriate WebDriver.Object
executeAsyncScript(String script, Object... args)
Object
executeJavascript(String javascript, Object... arguments)
Object
executeScript(String script, Object... args)
org.openqa.selenium.WebElement
findElement(org.openqa.selenium.By by)
List<org.openqa.selenium.WebElement>
findElements(org.openqa.selenium.By by)
List<org.openqa.selenium.WebElement>
findElementsWithoutWaiting(org.openqa.selenium.By by)
List<org.openqa.selenium.WebElement>
findElementsWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
org.openqa.selenium.WebElement
findElementWithoutScrolling(org.openqa.selenium.By by)
Same asfindElement(By)
but don't scroll to make the element visible.org.openqa.selenium.WebElement
findElementWithoutWaiting(org.openqa.selenium.By by)
org.openqa.selenium.WebElement
findElementWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
org.openqa.selenium.WebElement
findElementWithoutWaitingWithoutScrolling(org.openqa.selenium.By by)
Same asfindElementWithoutWaiting(By)
but don't scroll to make the element visible.void
get(String s)
org.openqa.selenium.Capabilities
getCapabilities()
org.openqa.selenium.remote.CommandExecutor
getCommandExecutor()
String
getCurrentUrl()
org.openqa.selenium.remote.ErrorHandler
getErrorHandler()
org.openqa.selenium.remote.FileDetector
getFileDetector()
String
getPageSource()
<X> X
getScreenshotAs(org.openqa.selenium.OutputType<X> outputType)
org.openqa.selenium.remote.SessionId
getSessionId()
int
getTimeout()
String
getTitle()
String
getWindowHandle()
Set<String>
getWindowHandles()
org.openqa.selenium.remote.RemoteWebDriver
getWrappedDriver()
boolean
hasElement(org.openqa.selenium.By by)
Should be used when the result is supposed to be true (otherwise you'll incur the timeout and an error will be raised!).boolean
hasElement(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
Should be used when the result is supposed to be true (otherwise you'll incur the timeout).boolean
hasElementWithoutWaiting(org.openqa.selenium.By by)
boolean
hasElementWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
boolean
hasElementWithoutWaitingWithoutScrolling(org.openqa.selenium.By by)
Same ashasElementWithoutWaiting(By)
but don't scroll to make the element visible.void
makeAlertDialogSilent()
void
makeConfirmDialogSilent(boolean accept)
There is no easy support for alert/confirm window methods yet, see - http://code.google.com/p/selenium/issues/detail?id=27 - http://www.google.com/codesearch/p?hl=en#2tHw6m3DZzo/branches /merge/common/test/java/org/openqa/selenium/AlertsTest.java The aim is :Alert alert = this.getDriver().switchTo().alert(); alert.accept();
Until then, the following hack does override the confirm method in Javascript to return the given value.void
makeElementVisible(org.openqa.selenium.By locator)
Shows hidden elements, as if they would be shown on hover.void
makeElementVisible(org.openqa.selenium.WebElement element)
org.openqa.selenium.WebDriver.Options
manage()
org.openqa.selenium.interactions.Actions
moveToTopLeftCornerOfTargetWithOffset(org.openqa.selenium.WebElement target, int offsetX, int offsetY, org.openqa.selenium.interactions.Actions chainFrom)
Same asActions.moveToElement(WebElement, int, int)
except that the target is the top-left corner of the target, instead of the center.org.openqa.selenium.WebDriver.Navigation
navigate()
void
quit()
void
scrollTo(int xCoord, int yCoord)
Instantaneously scrolls to the given coordinates inside the web page.org.openqa.selenium.WebElement
scrollTo(org.openqa.selenium.WebElement element)
void
setDriverImplicitWait()
Forces the driver to wait for agetTimeout()
number of seconds when looking up page elements before declaring that it cannot find them.void
setDriverImplicitWait(int timeout)
Forces the driver to wait for passed number of seconds when looking up page elements before declaring that it cannot find them.void
setErrorHandler(org.openqa.selenium.remote.ErrorHandler handler)
void
setFileDetector(org.openqa.selenium.remote.FileDetector detector)
void
setLogLevel(Level level)
void
setTextInputValue(org.openqa.selenium.WebElement textInputElement, String newTextValue)
Compared to using clear() + sendKeys(), this method ensures that an "input" event is triggered on the JavaScript side for an empty ("") value.void
setTimeout(int timeout)
org.openqa.selenium.WebDriver.TargetLocator
switchTo()
String
toString()
<T> T
waitUntilCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
<T> T
waitUntilCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition, int timeout)
void
waitUntilElementContainsAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element contain a certain value for an attribute.void
waitUntilElementDisappears(org.openqa.selenium.By locator)
Waits until the given locator corresponds to either a hidden or a deleted element.void
waitUntilElementDisappears(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By locator)
Waits until the given locator corresponds to either a hidden or a deleted element.void
waitUntilElementEndsWithAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element ends with a certain value for an attribute.void
waitUntilElementHasAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element has a certain value for an attribute.void
waitUntilElementHasNonEmptyAttributeValue(org.openqa.selenium.By locator, String attributeName)
Waits until the given element has a non-empty value for an attribute.void
waitUntilElementHasTextContent(org.openqa.selenium.By locator, String expectedValue)
Waits until the given element has a certain value as its inner text.void
waitUntilElementIsEnabled(org.openqa.selenium.WebElement element)
Waits until the given element is enabled.void
waitUntilElementIsVisible(org.openqa.selenium.By locator)
Wait until the element given by the locator is displayed.void
waitUntilElementIsVisible(org.openqa.selenium.By locator, int timeout)
Wait until the element given by the locator is displayed.void
waitUntilElementIsVisible(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By locator)
Wait until the element specified by the locator is displayed.void
waitUntilElementsAreVisible(org.openqa.selenium.By[] locators, boolean all)
Wait until one or all of an array of element locators are displayed.void
waitUntilElementsAreVisible(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By[] locators, boolean all)
Wait until one or all of an array of element locators are displayed.void
waitUntilJavascriptCondition(String booleanExpression, Object... arguments)
Waits until the provided javascript expression returnstrue
.void
waitUntilPageIsReloaded()
Waits until the previously added marker is no longer found on the current page, signaling that the page has been changed or reloaded.-
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver
addVirtualAuthenticator, builder, execute, execute, execute, findElement, findElements, findElements, getElementConverter, getExecuteMethod, log, perform, print, removeVirtualAuthenticator, resetInputState, setCommandExecutor, setElementConverter, setFoundBy, setSessionId, startSession
-
-
-
-
Method Detail
-
findElementWithoutWaiting
public org.openqa.selenium.WebElement findElementWithoutWaiting(org.openqa.selenium.By by)
-
findElementWithoutWaitingWithoutScrolling
public org.openqa.selenium.WebElement findElementWithoutWaitingWithoutScrolling(org.openqa.selenium.By by)
Same asfindElementWithoutWaiting(By)
but don't scroll to make the element visible. Useful for example whenverifying that the page has finished loading (and thus there's no element visible and we cannot scroll to it).- Since:
- 10.8.1, 10.9
-
findElementsWithoutWaiting
public List<org.openqa.selenium.WebElement> findElementsWithoutWaiting(org.openqa.selenium.By by)
-
findElementWithoutWaiting
public org.openqa.selenium.WebElement findElementWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
-
findElementsWithoutWaiting
public List<org.openqa.selenium.WebElement> findElementsWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
-
hasElement
public boolean hasElement(org.openqa.selenium.By by)
Should be used when the result is supposed to be true (otherwise you'll incur the timeout and an error will be raised!).
-
hasElementWithoutWaiting
public boolean hasElementWithoutWaiting(org.openqa.selenium.By by)
-
hasElementWithoutWaitingWithoutScrolling
public boolean hasElementWithoutWaitingWithoutScrolling(org.openqa.selenium.By by)
Same ashasElementWithoutWaiting(By)
but don't scroll to make the element visible. Useful for example whenverifying that the page has finished loading (and thus there's no element visible and we cannot scroll to it).- Since:
- 10.8.1, 10.9
-
hasElementWithoutWaiting
public boolean hasElementWithoutWaiting(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
-
hasElement
public boolean hasElement(org.openqa.selenium.WebElement element, org.openqa.selenium.By by)
Should be used when the result is supposed to be true (otherwise you'll incur the timeout).
-
waitUntilCondition
public <T> T waitUntilCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition, int timeout)
-
waitUntilCondition
public <T> T waitUntilCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
-
setDriverImplicitWait
public void setDriverImplicitWait()
Forces the driver to wait for agetTimeout()
number of seconds when looking up page elements before declaring that it cannot find them.
-
setDriverImplicitWait
public void setDriverImplicitWait(int timeout)
Forces the driver to wait for passed number of seconds when looking up page elements before declaring that it cannot find them.
-
getTimeout
public int getTimeout()
-
setTimeout
public void setTimeout(int timeout)
- Parameters:
timeout
- the number of seconds after which we consider the action to have failed
-
waitUntilElementIsVisible
public void waitUntilElementIsVisible(org.openqa.selenium.By locator)
Wait until the element given by the locator is displayed. Give up after timeout seconds.- Parameters:
locator
- the locator for the element to look for.
-
waitUntilElementIsVisible
public void waitUntilElementIsVisible(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By locator)
Wait until the element specified by the locator is displayed. Give up after timeout seconds.- Parameters:
parentElement
- where to look for the specified element,null
to look everywherelocator
- the locator for the element to look for- Since:
- 7.2
-
waitUntilElementIsVisible
public void waitUntilElementIsVisible(org.openqa.selenium.By locator, int timeout)
Wait until the element given by the locator is displayed. Give up after specified timeout (in seconds).Only use this API if you absolutely need a longer timeout than the default, otherwise use
waitUntilElementIsVisible(org.openqa.selenium.By)
.- Parameters:
locator
- the locator for the element to look fortimeout
- the timeout after which to give up- Since:
- 5.4RC1
-
waitUntilElementsAreVisible
public void waitUntilElementsAreVisible(org.openqa.selenium.By[] locators, boolean all)
Wait until one or all of an array of element locators are displayed.- Parameters:
locators
- the array of element locators to look forall
- if true then don't return until all elements are found. Otherwise return after finding one
-
waitUntilElementsAreVisible
public void waitUntilElementsAreVisible(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By[] locators, boolean all)
Wait until one or all of an array of element locators are displayed.- Parameters:
parentElement
- where to look for the specified elements,null
to look everywherelocators
- the array of element locators to look forall
- if true then don't return until all elements are found. Otherwise return after finding one- Since:
- 7.2
-
waitUntilElementDisappears
public void waitUntilElementDisappears(org.openqa.selenium.By locator)
Waits until the given locator corresponds to either a hidden or a deleted element.- Parameters:
locator
- the locator to wait for
-
waitUntilElementDisappears
public void waitUntilElementDisappears(org.openqa.selenium.WebElement parentElement, org.openqa.selenium.By locator)
Waits until the given locator corresponds to either a hidden or a deleted element.- Parameters:
parentElement
- the element from which to start the searchlocator
- the locator to wait for
-
makeElementVisible
public void makeElementVisible(org.openqa.selenium.By locator)
Shows hidden elements, as if they would be shown on hover. Currently implemented using JavaScript. Will throw aRuntimeException
if the web driver does not support JavaScript or JavaScript is disabled.- Parameters:
locator
- locator used to find the element, in case multiple elements are found, the first is used
-
makeElementVisible
public void makeElementVisible(org.openqa.selenium.WebElement element)
-
waitUntilElementHasNonEmptyAttributeValue
public void waitUntilElementHasNonEmptyAttributeValue(org.openqa.selenium.By locator, String attributeName)
Waits until the given element has a non-empty value for an attribute.- Parameters:
locator
- the element to wait onattributeName
- the name of the attribute to check
-
waitUntilElementIsEnabled
public void waitUntilElementIsEnabled(org.openqa.selenium.WebElement element)
Waits until the given element is enabled.- Parameters:
element
- the element to wait on- Since:
- 12.9RC1
-
waitUntilElementHasAttributeValue
public void waitUntilElementHasAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element has a certain value for an attribute.- Parameters:
locator
- the element to wait onattributeName
- the name of the attribute to checkexpectedValue
- the attribute value to wait for
-
waitUntilElementEndsWithAttributeValue
public void waitUntilElementEndsWithAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element ends with a certain value for an attribute.- Parameters:
locator
- the element to wait onattributeName
- the name of the attribute to checkexpectedValue
- the attribute value to wait for
-
waitUntilElementContainsAttributeValue
public void waitUntilElementContainsAttributeValue(org.openqa.selenium.By locator, String attributeName, String expectedValue)
Waits until the given element contain a certain value for an attribute.- Parameters:
locator
- the element to wait on.attributeName
- the name of attribute to check.expectedValue
- the value that should be contained in the attribute.- Since:
- 11.1RC1
-
waitUntilElementHasTextContent
public void waitUntilElementHasTextContent(org.openqa.selenium.By locator, String expectedValue)
Waits until the given element has a certain value as its inner text.- Parameters:
locator
- the element to wait onexpectedValue
- the content value to wait for- Since:
- 3.2M3
-
makeConfirmDialogSilent
public void makeConfirmDialogSilent(boolean accept)
There is no easy support for alert/confirm window methods yet, see - http://code.google.com/p/selenium/issues/detail?id=27 - http://www.google.com/codesearch/p?hl=en#2tHw6m3DZzo/branches /merge/common/test/java/org/openqa/selenium/AlertsTest.java The aim is :Alert alert = this.getDriver().switchTo().alert(); alert.accept();
Until then, the following hack does override the confirm method in Javascript to return the given value.- Parameters:
accept
-true
to accept the confirmation dialog,false
to cancel it
-
makeAlertDialogSilent
public void makeAlertDialogSilent()
- Since:
- 3.2M3
- See Also:
makeConfirmDialogSilent(boolean)
-
waitUntilJavascriptCondition
public void waitUntilJavascriptCondition(String booleanExpression, Object... arguments) throws IllegalArgumentException
Waits until the provided javascript expression returnstrue
.The wait is done while the expression returns
false
.- Parameters:
booleanExpression
- the javascript expression to wait for to returntrue
. The expression must have areturn
statement on the last line, e.g."return window.jQuery != null"
arguments
- any arguments passed to the javascript expression- Throws:
IllegalArgumentException
- if the evaluated expression does not return a boolean result- Since:
- 6.2
- See Also:
executeJavascript(String, Object...)
-
get
public void get(String s)
- Specified by:
get
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
get
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getCurrentUrl
public String getCurrentUrl()
- Specified by:
getCurrentUrl
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
getCurrentUrl
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getTitle
public String getTitle()
- Specified by:
getTitle
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
getTitle
in classorg.openqa.selenium.remote.RemoteWebDriver
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
- Specified by:
findElements
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElements
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
findElements
in classorg.openqa.selenium.remote.RemoteWebDriver
-
scrollTo
public org.openqa.selenium.WebElement scrollTo(org.openqa.selenium.WebElement element)
-
scrollTo
public void scrollTo(int xCoord, int yCoord)
Instantaneously scrolls to the given coordinates inside the web page. If you want to scroll to a specificWebElement
, seescrollTo(WebElement)
.- Parameters:
xCoord
- is the pixel along the horizontal axis of the web page that you want displayed in the upper leftyCoord
- is the pixel along the vertical axis of the web page that you want displayed in the upper left- Since:
- 13.3RC1, 12.10.7
- See Also:
- MDN Web Docs -
Element.scrollTo(),
scrollTo(WebElement)
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
- Specified by:
findElement
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElement
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
findElement
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getPageSource
public String getPageSource()
- Specified by:
getPageSource
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
getPageSource
in classorg.openqa.selenium.remote.RemoteWebDriver
-
close
public void close()
- Specified by:
close
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
close
in classorg.openqa.selenium.remote.RemoteWebDriver
-
quit
public void quit()
- Specified by:
quit
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
quit
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getWindowHandles
public Set<String> getWindowHandles()
- Specified by:
getWindowHandles
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
getWindowHandles
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getWindowHandle
public String getWindowHandle()
- Specified by:
getWindowHandle
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
getWindowHandle
in classorg.openqa.selenium.remote.RemoteWebDriver
-
switchTo
public org.openqa.selenium.WebDriver.TargetLocator switchTo()
- Specified by:
switchTo
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
switchTo
in classorg.openqa.selenium.remote.RemoteWebDriver
-
navigate
public org.openqa.selenium.WebDriver.Navigation navigate()
- Specified by:
navigate
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
navigate
in classorg.openqa.selenium.remote.RemoteWebDriver
-
manage
public org.openqa.selenium.WebDriver.Options manage()
- Specified by:
manage
in interfaceorg.openqa.selenium.WebDriver
- Overrides:
manage
in classorg.openqa.selenium.remote.RemoteWebDriver
-
setFileDetector
public void setFileDetector(org.openqa.selenium.remote.FileDetector detector)
- Overrides:
setFileDetector
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getSessionId
public org.openqa.selenium.remote.SessionId getSessionId()
- Overrides:
getSessionId
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getErrorHandler
public org.openqa.selenium.remote.ErrorHandler getErrorHandler()
- Overrides:
getErrorHandler
in classorg.openqa.selenium.remote.RemoteWebDriver
-
setErrorHandler
public void setErrorHandler(org.openqa.selenium.remote.ErrorHandler handler)
- Overrides:
setErrorHandler
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getCommandExecutor
public org.openqa.selenium.remote.CommandExecutor getCommandExecutor()
- Overrides:
getCommandExecutor
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()
- Specified by:
getCapabilities
in interfaceorg.openqa.selenium.HasCapabilities
- Overrides:
getCapabilities
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType) throws org.openqa.selenium.WebDriverException
- Specified by:
getScreenshotAs
in interfaceorg.openqa.selenium.TakesScreenshot
- Overrides:
getScreenshotAs
in classorg.openqa.selenium.remote.RemoteWebDriver
- Throws:
org.openqa.selenium.WebDriverException
-
executeScript
public Object executeScript(String script, Object... args)
- Specified by:
executeScript
in interfaceorg.openqa.selenium.JavascriptExecutor
- Overrides:
executeScript
in classorg.openqa.selenium.remote.RemoteWebDriver
-
executeAsyncScript
public Object executeAsyncScript(String script, Object... args)
- Specified by:
executeAsyncScript
in interfaceorg.openqa.selenium.JavascriptExecutor
- Overrides:
executeAsyncScript
in classorg.openqa.selenium.remote.RemoteWebDriver
-
setLogLevel
public void setLogLevel(Level level)
- Overrides:
setLogLevel
in classorg.openqa.selenium.remote.RemoteWebDriver
-
getFileDetector
public org.openqa.selenium.remote.FileDetector getFileDetector()
- Overrides:
getFileDetector
in classorg.openqa.selenium.remote.RemoteWebDriver
-
toString
public String toString()
- Overrides:
toString
in classorg.openqa.selenium.remote.RemoteWebDriver
-
setTextInputValue
public void setTextInputValue(org.openqa.selenium.WebElement textInputElement, String newTextValue)
Compared to using clear() + sendKeys(), this method ensures that an "input" event is triggered on the JavaScript side for an empty ("") value. Without this, the clear() method triggers just a "change" event.- Parameters:
textInputElement
- an element accepting text inputnewTextValue
- the new text value to set- Since:
- 7.2M3
- See Also:
- Issue 214
-
addPageNotYetReloadedMarker
public void addPageNotYetReloadedMarker()
Adds a marker in the DOM of the browser that will only be available until we leave or reload the current page.To be used mainly before
waitUntilPageIsReloaded()
.- Since:
- 7.4M2
-
waitUntilPageIsReloaded
public void waitUntilPageIsReloaded()
Waits until the previously added marker is no longer found on the current page, signaling that the page has been changed or reloaded. Useful when the page loading is done by jJavaScript and Selenium can not help in telling us when we have left the old page.To be used always after
addPageNotYetReloadedMarker()
.- Since:
- 7.4M2
-
findElementWithoutScrolling
public org.openqa.selenium.WebElement findElementWithoutScrolling(org.openqa.selenium.By by)
Same asfindElement(By)
but don't scroll to make the element visible. Useful for example when verifying that the page has finished loading (and thus there's no element visible and we cannot scroll to it).- Since:
- 10.8.1, 10.9
-
getWrappedDriver
public org.openqa.selenium.remote.RemoteWebDriver getWrappedDriver()
- Returns:
- the original
RemoteWebDriver
created for selenium tests. The original driver should be used for customActions
. - Since:
- 11.3RC1
-
dragAndDrop
public void dragAndDrop(org.openqa.selenium.WebElement source, org.openqa.selenium.WebElement target)
Utility method to perform a drag & drop by using the appropriate WebDriver.- Parameters:
source
- the element to dragtarget
- the element where to drop- Since:
- 11.3RC1
-
createActions
public org.openqa.selenium.interactions.Actions createActions()
Utility method to build a proper instance ofActions
.- Returns:
- a new instance of
Actions
. - Since:
- 11.9RC1
-
moveToTopLeftCornerOfTargetWithOffset
public org.openqa.selenium.interactions.Actions moveToTopLeftCornerOfTargetWithOffset(org.openqa.selenium.WebElement target, int offsetX, int offsetY, org.openqa.selenium.interactions.Actions chainFrom)
Same asActions.moveToElement(WebElement, int, int)
except that the target is the top-left corner of the target, instead of the center.- Parameters:
target
- the element for which we want to reach the offset from the top-left corner.offsetX
- the offset on the right of the top-left corner to move tooffsetY
- the offset on the bottom of the top-left corner to move tochainFrom
- the existing actions to be chain to, or null to create a dedicated chain of actions.- Returns:
- an actions with the right move.
- Since:
- 11.9RC1
-
-