Package org.openqa.selenium.safari
Class SafariDriver
- java.lang.Object
-
- org.openqa.selenium.remote.RemoteWebDriver
-
- org.openqa.selenium.safari.SafariDriver
-
- All Implemented Interfaces:
HasCapabilities
,Interactive
,JavascriptExecutor
,PrintsPage
,HasDebugger
,HasPermissions
,SearchContext
,TakesScreenshot
,HasVirtualAuthenticator
,WebDriver
public class SafariDriver extends RemoteWebDriver implements HasPermissions, HasDebugger
A WebDriver implementation that controls Safari using a browser extension (consequently, only Safari 5.1+ is supported). This driver can be configured using theSafariOptions
class.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver
RemoteWebDriver.RemoteTargetLocator, RemoteWebDriver.RemoteWebDriverOptions, RemoteWebDriver.When
-
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts, WebDriver.Window
-
-
Constructor Summary
Constructors Constructor Description SafariDriver()
Initializes a new SafariDriver} class with defaultSafariOptions
.SafariDriver(DriverService service, SafariOptions options)
Initializes a new SafariDriver using the specifiedSafariOptions
.SafariDriver(DriverService service, SafariOptions options, ClientConfig clientConfig)
SafariDriver(SafariDriverService safariService)
Initializes a new SafariDriver backed by the specifiedSafariDriverService
.SafariDriver(SafariOptions safariOptions)
Initializes a new SafariDriver using the specifiedSafariOptions
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attachDebugger()
This opens Safari's Web Inspector If driver subsequently executes script of "debugger;" the execution will pause, no additional commands will be processed, and the code will time out.static RemoteWebDriverBuilder
builder()
java.util.Map<java.lang.String,java.lang.Boolean>
getPermissions()
void
setFileDetector(FileDetector detector)
Set the file detector to be used when sending keyboard input.void
setPermissions(java.lang.String permission, boolean value)
Set permission on the browser.-
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver
addVirtualAuthenticator, close, execute, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElements, findElements, findElements, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getPageSource, getScreenshotAs, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, perform, print, quit, removeVirtualAuthenticator, resetInputState, setCommandExecutor, setElementConverter, setErrorHandler, setFoundBy, setLogLevel, setSessionId, startSession, switchTo, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openqa.selenium.JavascriptExecutor
executeScript, getPinnedScripts, pin, unpin
-
-
-
-
Constructor Detail
-
SafariDriver
public SafariDriver()
Initializes a new SafariDriver} class with defaultSafariOptions
.
-
SafariDriver
public SafariDriver(SafariOptions safariOptions)
Initializes a new SafariDriver using the specifiedSafariOptions
.- Parameters:
safariOptions
- safari specific options / capabilities for the driver
-
SafariDriver
public SafariDriver(SafariDriverService safariService)
Initializes a new SafariDriver backed by the specifiedSafariDriverService
.- Parameters:
safariService
- preconfigured safari service
-
SafariDriver
public SafariDriver(DriverService service, SafariOptions options)
Initializes a new SafariDriver using the specifiedSafariOptions
.- Parameters:
service
- eitherSafariTechPreviewDriverService
orSafariDriverService
options
- safari specific options / capabilities for the driver
-
SafariDriver
public SafariDriver(DriverService service, SafariOptions options, ClientConfig clientConfig)
-
-
Method Detail
-
builder
@Beta public static RemoteWebDriverBuilder builder()
-
setPermissions
public void setPermissions(java.lang.String permission, boolean value)
Description copied from interface:HasPermissions
Set permission on the browser. The only supported permission at this time is "getUserMedia".- Specified by:
setPermissions
in interfaceHasPermissions
- Parameters:
permission
- the name of the item to set permission on.value
- whether the permission has been granted.
-
getPermissions
public java.util.Map<java.lang.String,java.lang.Boolean> getPermissions()
- Specified by:
getPermissions
in interfaceHasPermissions
- Returns:
- each permission and whether it is allowed or not.
-
attachDebugger
public void attachDebugger()
Description copied from interface:HasDebugger
This opens Safari's Web Inspector If driver subsequently executes script of "debugger;" the execution will pause, no additional commands will be processed, and the code will time out.- Specified by:
attachDebugger
in interfaceHasDebugger
-
setFileDetector
public void setFileDetector(FileDetector detector)
Description copied from class:RemoteWebDriver
Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing.- Overrides:
setFileDetector
in classRemoteWebDriver
- Parameters:
detector
- The detector to use. Must not be null.- See Also:
FileDetector
,LocalFileDetector
,UselessFileDetector
-
-