public class DefaultExtWebDriver extends Object implements ExtWebDriver, HighlightProvider
ExtWebDriver.StaleWindowIdListException
org.openqa.selenium.WebDriver.ImeHandler, org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
Constructor and Description |
---|
DefaultExtWebDriver()
Constructor for ExtWebDriver
|
Modifier and Type | Method and Description |
---|---|
void |
back()
Simulates browser Back button
|
void |
cancelNativeDialog()
Clicks cancel on the open confirmation dialog attached to the current
window
|
void |
close() |
void |
closeCurrentBrowser()
Closes the browser window, but does not kill IEDriverServer.exe, use this
if you changed browsers mid-session and want to close the window.
|
void |
confirmNativeDialog()
Clicks ok on the open alert dialog OR confirmation dialog attached to the
current window
|
void |
currentWindowMaximize()
Maximizes the browser window
|
void |
eval(String javaScript)
Executes JavaScript
|
String |
evaluateXpath(String xpath)
Evaluates an XPath in JavaScript to return a string value based on the
resulting node(s) or XPath function results
|
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By arg0) |
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.By arg0) |
void |
focus()
Request focus for the active window with the current WebDriver
|
void |
forward()
Simulates browser Forward button
|
void |
get(String arg0) |
String[] |
getAllWindowIds()
Retrieves the windowHandle IDs
|
String |
getBrowserName()
Retrieves the name of the browser currently being operated by the
webdriver
|
String |
getBrowserVersion()
Retrieves the version of the browser currently being operated by the
webdriver
|
String |
getCurrentUrl() |
Map<String,String> |
getGeneratedHtmlSource()
Retrieves current state of the DOM in HTML format for each of the
document's frames.
|
String |
getHighlightColor(String highlightMode)
Get the highlight color based on mode
|
String |
getHtmlSource()
Returns the original HTML source of the current frame
|
long |
getMaxRequestTimeout()
Gets the timeout used by default when waiting on actions
|
String |
getNativeDialogText()
Retrieves the text of the open native dialog attached to the current
window
|
String |
getPageSource() |
String |
getSessionId()
Gets the id of the current session
|
String |
getTitle() |
String |
getWindowHandle() |
Set<String> |
getWindowHandles() |
String |
getWindowId()
Returns the current window handle ID
|
org.openqa.selenium.WebDriver |
getWrappedDriver()
Gets the underlying WebDriver instance
|
int |
getXpathCount(String string)
Returns the count of nodes that would be returned by an XPath expression
|
boolean |
isFocusOnClick()
Indicates the current setting for setting window focus as part of a click
action
|
boolean |
isHighlight() |
boolean |
isJavascriptClickMode()
Indicates the current setting for clicking on interactive elements
|
boolean |
isJavascriptTypeMode()
Indicates the current setting for entry of text in input fields
|
org.openqa.selenium.WebDriver.Options |
manage() |
org.openqa.selenium.WebDriver.Navigation |
navigate() |
void |
open(String url)
Opens the browser
|
void |
quit() |
void |
refresh()
Reloads the current URL
|
void |
selectFrame(IElement element)
Selects a new frame from within the current frame
|
void |
selectLastFrame()
Selects the previously selected frame
|
String |
selectPopupWindow()
Sets the most recently opened browser window as the active windwo for the
current WebDriver.
|
void |
selectWindow(String windowId)
Sets the active window for the current WebDriver
|
void |
setClickMode(boolean useJavascript)
Configures the use of JavaScript for clicking on interactive elements,
rather than relying on the native WebDriver methods
|
void |
setClientProperties(ClientProperties cp)
Sets the client configuration to use
|
void |
setFocusOnClick(boolean doFocus)
One of several options to determine if the focus method should actually
focus
|
void |
setHighlightColors(Map<String,String> colorMap) |
void |
setIsHighlight(boolean isHighlight)
Sets whether to highlight elements when performing actions
|
void |
setMaxRequestTimeout(String timeout)
Sets the maximum timeout value for actions
|
void |
setSessionId(String id)
Sets the current session to be used for all actions on ExtWebDdriver and
Widgets
|
void |
setTypeMode(boolean useJavascript)
Configures the use of JavaScript for entry of input fields, rather than
relying on the native WebDriver methods
|
void |
setWrappedDriver(org.openqa.selenium.WebDriver wd)
Replaces the underlying WebDriver instance
|
void |
storeCurrentWindowIds()
Stores handles for all existing windows for later comparison
|
org.openqa.selenium.WebDriver.TargetLocator |
switchTo() |
void |
unselectFrame()
Selects the top most frame
|
void |
windowScroll(int i,
int j)
Scrolls the current browser window to specific position
|
void |
windowScrollBy(int i,
int j)
Scrolls the current browser by specific amount
|
public void setWrappedDriver(org.openqa.selenium.WebDriver wd)
ExtWebDriver
setWrappedDriver
in interface ExtWebDriver
wd
- the new WebDriver instancepublic void setClientProperties(ClientProperties cp)
cp
- client configurationpublic void setTypeMode(boolean useJavascript)
ExtWebDriver
setTypeMode
in interface ExtWebDriver
useJavascript
- true to enable the use of JavaScript, default is falsepublic boolean isJavascriptTypeMode()
ExtWebDriver
isJavascriptTypeMode
in interface ExtWebDriver
public void setClickMode(boolean useJavascript)
ExtWebDriver
setClickMode
in interface ExtWebDriver
useJavascript
- true to enable the use of JavaScript, default is falsepublic boolean isJavascriptClickMode()
ExtWebDriver
isJavascriptClickMode
in interface ExtWebDriver
public void setFocusOnClick(boolean doFocus)
ExtWebDriver
setFocusOnClick
in interface ExtWebDriver
doFocus
- true to force focus to the window as part of the click actionExtWebDriver.focus()
public boolean isFocusOnClick()
ExtWebDriver
isFocusOnClick
in interface ExtWebDriver
public void setIsHighlight(boolean isHighlight)
HighlightProvider
setIsHighlight
in interface HighlightProvider
isHighlight
- whether to allow highlightpublic boolean isHighlight()
isHighlight
in interface HighlightProvider
public void setHighlightColors(Map<String,String> colorMap)
setHighlightColors
in interface HighlightProvider
public String getHighlightColor(String highlightMode)
HighlightProvider
getHighlightColor
in interface HighlightProvider
highlightMode
- the mode for which to get colorpublic void open(String url)
ExtWebDriver
open
in interface ExtWebDriver
url
- the web address for initial navigationpublic void back()
ExtWebDriver
back
in interface ExtWebDriver
public void closeCurrentBrowser()
ExtWebDriver
closeCurrentBrowser
in interface ExtWebDriver
WebDriver.close()
public void close()
close
in interface org.openqa.selenium.WebDriver
public void forward()
ExtWebDriver
forward
in interface ExtWebDriver
public void refresh()
ExtWebDriver
refresh
in interface ExtWebDriver
public void storeCurrentWindowIds()
ExtWebDriver
storeCurrentWindowIds
in interface ExtWebDriver
ExtWebDriver.selectPopupWindow()
public void focus()
ExtWebDriver
focus
in interface ExtWebDriver
public void selectWindow(String windowId)
ExtWebDriver
selectWindow
in interface ExtWebDriver
windowId
- the window id stringpublic String selectPopupWindow() throws ExtWebDriver.StaleWindowIdListException
ExtWebDriver
ExtWebDriver.storeCurrentWindowIds()
was called before the window
opened and that only one window has opened since.selectPopupWindow
in interface ExtWebDriver
ExtWebDriver.StaleWindowIdListException
- when the difference between the stored window ids and the
current window ids is more than one windowpublic String[] getAllWindowIds()
ExtWebDriver
getAllWindowIds
in interface ExtWebDriver
public String getWindowId()
getWindowId
in interface ExtWebDriver
public void currentWindowMaximize()
currentWindowMaximize
in interface ExtWebDriver
public void windowScroll(int i, int j)
windowScroll
in interface ExtWebDriver
i
- Horizontal positionj
- Vertical positionpublic void windowScrollBy(int i, int j)
windowScrollBy
in interface ExtWebDriver
i
- Horizontal scroll amountj
- Vertical scroll amountpublic void eval(String javaScript)
ExtWebDriver
eval
in interface ExtWebDriver
javaScript
- the script to executepublic String getHtmlSource()
ExtWebDriver
getHtmlSource
in interface ExtWebDriver
public Map<String,String> getGeneratedHtmlSource()
ExtWebDriver
getGeneratedHtmlSource
in interface ExtWebDriver
public void selectFrame(IElement element) throws Exception
ExtWebDriver
selectFrame
in interface ExtWebDriver
element
- the object representing the iframe element to selectException
public void unselectFrame()
unselectFrame
in interface ExtWebDriver
public void selectLastFrame()
ExtWebDriver
selectLastFrame
in interface ExtWebDriver
public String evaluateXpath(String xpath) throws Exception
ExtWebDriver
evaluateXpath
in interface ExtWebDriver
xpath
- the XPath to evaluateException
- if the evaluation of the XPath failspublic void confirmNativeDialog() throws Exception
ExtWebDriver
confirmNativeDialog
in interface ExtWebDriver
Exception
- if the native dialog does not existpublic void cancelNativeDialog()
ExtWebDriver
cancelNativeDialog
in interface ExtWebDriver
public String getNativeDialogText()
ExtWebDriver
getNativeDialogText
in interface ExtWebDriver
public String getBrowserName()
ExtWebDriver
getBrowserName
in interface ExtWebDriver
public String getBrowserVersion()
ExtWebDriver
getBrowserVersion
in interface ExtWebDriver
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By arg0)
findElement
in interface org.openqa.selenium.SearchContext
findElement
in interface org.openqa.selenium.WebDriver
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By arg0)
findElements
in interface org.openqa.selenium.SearchContext
findElements
in interface org.openqa.selenium.WebDriver
public void get(String arg0)
get
in interface org.openqa.selenium.WebDriver
public String getCurrentUrl()
getCurrentUrl
in interface org.openqa.selenium.WebDriver
public String getPageSource()
getPageSource
in interface org.openqa.selenium.WebDriver
public String getTitle()
getTitle
in interface org.openqa.selenium.WebDriver
public String getWindowHandle()
getWindowHandle
in interface org.openqa.selenium.WebDriver
public Set<String> getWindowHandles()
getWindowHandles
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebDriver.Options manage()
manage
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebDriver.Navigation navigate()
navigate
in interface org.openqa.selenium.WebDriver
public void quit()
quit
in interface org.openqa.selenium.WebDriver
public org.openqa.selenium.WebDriver.TargetLocator switchTo()
switchTo
in interface org.openqa.selenium.WebDriver
public void setMaxRequestTimeout(String timeout)
ExtWebDriver
setMaxRequestTimeout
in interface ExtWebDriver
timeout
- String representation millisecondspublic long getMaxRequestTimeout()
ExtWebDriver
getMaxRequestTimeout
in interface ExtWebDriver
public org.openqa.selenium.WebDriver getWrappedDriver()
ExtWebDriver
getWrappedDriver
in interface ExtWebDriver
public int getXpathCount(String string)
ExtWebDriver
getXpathCount
in interface ExtWebDriver
string
- the XPAth expression to countpublic void setSessionId(String id)
ExtWebDriver
setSessionId
in interface ExtWebDriver
id
- the identifier for the sessionpublic String getSessionId()
ExtWebDriver
getSessionId
in interface ExtWebDriver
Copyright © 2018. All rights reserved.