Package org.openqa.selenium.remote
Class RemoteWebDriver
java.lang.Object
org.openqa.selenium.remote.RemoteWebDriver
- All Implemented Interfaces:
org.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement,org.openqa.selenium.HasCapabilities,org.openqa.selenium.HasDownloads,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 RemoteWebDriver
extends Object
implements org.openqa.selenium.WebDriver, org.openqa.selenium.JavascriptExecutor, org.openqa.selenium.HasCapabilities, org.openqa.selenium.HasDownloads, org.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement, org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator, org.openqa.selenium.interactions.Interactive, org.openqa.selenium.PrintsPage, org.openqa.selenium.TakesScreenshot
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classstatic enumNested classes/interfaces inherited from interface org.openqa.selenium.HasDownloads
org.openqa.selenium.HasDownloads.DownloadedFileNested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
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 -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities) RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, boolean enableTracing) RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig) RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig, boolean enableTracing) RemoteWebDriver(org.openqa.selenium.Capabilities capabilities) RemoteWebDriver(org.openqa.selenium.Capabilities capabilities, boolean enableTracing) RemoteWebDriver(CommandExecutor executor, org.openqa.selenium.Capabilities capabilities) RemoteWebDriver(CommandExecutor executor, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig) -
Method Summary
Modifier and TypeMethodDescriptionorg.openqa.selenium.virtualauthenticator.VirtualAuthenticatoraddVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions options) static RemoteWebDriverBuilderbuilder()voidclose()voidDeletes all downloadable files.voiddownloadFile(String fileName, Path targetLocation) Downloads a file from the specified location.protected Responseprotected Responseprotected Responseexecute(CommandPayload payload) executeAsyncScript(String script, Object... args) @Nullable ObjectexecuteScript(@NonNull String script, @Nullable Object... args) org.openqa.selenium.WebElementfindElement(org.openqa.selenium.By locator) List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By locator) List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context, BiFunction<String, Object, CommandPayload> findCommand, org.openqa.selenium.By locator) fireSessionEvent(String eventType) Fires a custom session event to the remote server event bus without a payload.fireSessionEvent(String eventType, Map<String, Object> payload) Fires a custom session event to the remote server event bus.void@NonNull org.openqa.selenium.Capabilitiesorg.openqa.selenium.remote.http.ClientConfigDeprecated.List<org.openqa.selenium.HasDownloads.DownloadedFile> Retrieves the list of files downloaded by browser.protected JsonToWebElementConverterprotected ExecuteMethodorg.openqa.selenium.federatedcredentialmanagement.FederatedCredentialManagementDialog<X> XgetScreenshotAs(org.openqa.selenium.OutputType<X> outputType) getTitle()booleanprotected voidlog(SessionId sessionId, String commandName, Object toLog, RemoteWebDriver.When when) Override this to be notified at key points in the execution of a command.org.openqa.selenium.WebDriver.Optionsmanage()org.openqa.selenium.WebDriver.Navigationnavigate()network()voidperform(Collection<org.openqa.selenium.interactions.Sequence> actions) org.openqa.selenium.Pdfprint(org.openqa.selenium.print.PrintOptions printOptions) voidquit()voidremoveVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticator authenticator) voidvoidscript()protected voidsetCommandExecutor(CommandExecutor executor) voidsetDelayEnabled(boolean enabled) protected voidsetElementConverter(JsonToWebElementConverter converter) voidsetErrorHandler(ErrorHandler handler) voidsetFileDetector(FileDetector detector) Set the file detector to be used when sending keyboard input.protected voidsetFoundBy(org.openqa.selenium.SearchContext context, org.openqa.selenium.WebElement element, String by, String using) voidsetLogLevel(Level level) Sets the RemoteWebDriver's client log level.protected voidsetSessionId(String opaqueKey) protected voidstartSession(org.openqa.selenium.Capabilities capabilities) org.openqa.selenium.WebDriver.TargetLocatorswitchTo()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openqa.selenium.HasDownloads
requireDownloadsEnabledMethods inherited from interface org.openqa.selenium.JavascriptExecutor
executeScript, getPinnedScripts, pin, unpin
-
Field Details
-
capabilities
protected org.openqa.selenium.Capabilities capabilities
-
-
Constructor Details
-
RemoteWebDriver
protected RemoteWebDriver() -
RemoteWebDriver
public RemoteWebDriver(org.openqa.selenium.Capabilities capabilities) -
RemoteWebDriver
public RemoteWebDriver(org.openqa.selenium.Capabilities capabilities, boolean enableTracing) -
RemoteWebDriver
-
RemoteWebDriver
public RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig) -
RemoteWebDriver
public RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, boolean enableTracing) -
RemoteWebDriver
public RemoteWebDriver(URL remoteAddress, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig, boolean enableTracing) -
RemoteWebDriver
-
RemoteWebDriver
public RemoteWebDriver(CommandExecutor executor, org.openqa.selenium.Capabilities capabilities, org.openqa.selenium.remote.http.ClientConfig clientConfig)
-
-
Method Details
-
builder
-
getSessionId
-
setSessionId
-
startSession
protected void startSession(org.openqa.selenium.Capabilities capabilities) -
getErrorHandler
-
setErrorHandler
-
getClientConfig
public org.openqa.selenium.remote.http.ClientConfig getClientConfig() -
getCommandExecutor
-
setCommandExecutor
-
getCapabilities
public @NonNull org.openqa.selenium.Capabilities getCapabilities()- Specified by:
getCapabilitiesin interfaceorg.openqa.selenium.HasCapabilities
-
get
- Specified by:
getin interfaceorg.openqa.selenium.WebDriver
-
getTitle
- Specified by:
getTitlein interfaceorg.openqa.selenium.WebDriver
-
getCurrentUrl
- Specified by:
getCurrentUrlin interfaceorg.openqa.selenium.WebDriver
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> outputType) throws org.openqa.selenium.WebDriverException - Specified by:
getScreenshotAsin interfaceorg.openqa.selenium.TakesScreenshot- Throws:
org.openqa.selenium.WebDriverException
-
print
public org.openqa.selenium.Pdf print(org.openqa.selenium.print.PrintOptions printOptions) throws org.openqa.selenium.WebDriverException - Specified by:
printin interfaceorg.openqa.selenium.PrintsPage- Throws:
org.openqa.selenium.WebDriverException
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By locator) - Specified by:
findElementin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementin interfaceorg.openqa.selenium.WebDriver
-
findElements
- Specified by:
findElementsin interfaceorg.openqa.selenium.SearchContext- Specified by:
findElementsin interfaceorg.openqa.selenium.WebDriver
-
findElements
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.SearchContext context, BiFunction<String, Object, CommandPayload> findCommand, org.openqa.selenium.By locator) -
setFoundBy
-
getPageSource
- Specified by:
getPageSourcein interfaceorg.openqa.selenium.WebDriver
-
close
public void close()- Specified by:
closein interfaceorg.openqa.selenium.WebDriver
-
quit
public void quit()- Specified by:
quitin interfaceorg.openqa.selenium.WebDriver
-
getWindowHandles
- Specified by:
getWindowHandlesin interfaceorg.openqa.selenium.WebDriver
-
getWindowHandle
- Specified by:
getWindowHandlein interfaceorg.openqa.selenium.WebDriver
-
executeScript
- Specified by:
executeScriptin interfaceorg.openqa.selenium.JavascriptExecutor
-
executeAsyncScript
- Specified by:
executeAsyncScriptin interfaceorg.openqa.selenium.JavascriptExecutor
-
switchTo
public org.openqa.selenium.WebDriver.TargetLocator switchTo()- Specified by:
switchToin interfaceorg.openqa.selenium.WebDriver
-
manage
public org.openqa.selenium.WebDriver.Options manage()- Specified by:
managein interfaceorg.openqa.selenium.WebDriver
-
script
-
network
-
getElementConverter
-
setElementConverter
-
setLogLevel
Sets the RemoteWebDriver's client log level.- Parameters:
level- The log level to use.
-
execute
-
execute
-
execute
-
getExecuteMethod
-
perform
- Specified by:
performin interfaceorg.openqa.selenium.interactions.Interactive
-
resetInputState
public void resetInputState()- Specified by:
resetInputStatein interfaceorg.openqa.selenium.interactions.Interactive
-
addVirtualAuthenticator
@NullMarked public org.openqa.selenium.virtualauthenticator.VirtualAuthenticator addVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions options) - Specified by:
addVirtualAuthenticatorin interfaceorg.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
-
removeVirtualAuthenticator
@NullMarked public void removeVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticator authenticator) - Specified by:
removeVirtualAuthenticatorin interfaceorg.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
-
isDownloadsEnabled
public boolean isDownloadsEnabled()- Specified by:
isDownloadsEnabledin interfaceorg.openqa.selenium.HasDownloads
-
getDownloadableFiles
Deprecated.Use methodgetDownloadedFiles()insteadRetrieves the names of the files downloaded by browser.- Specified by:
getDownloadableFilesin interfaceorg.openqa.selenium.HasDownloads- Returns:
- A list containing the names of the downloaded files.
- Throws:
org.openqa.selenium.WebDriverException- if capability to enable downloads is not set
-
getDownloadedFiles
Retrieves the list of files downloaded by browser.- Specified by:
getDownloadedFilesin interfaceorg.openqa.selenium.HasDownloads- Returns:
- A list containing the names, size etc. of the downloaded files.
- Throws:
org.openqa.selenium.WebDriverException- if capability to enable downloads is not set
-
downloadFile
Downloads a file from the specified location.- Specified by:
downloadFilein interfaceorg.openqa.selenium.HasDownloads- Parameters:
fileName- the name of the file to downloadtargetLocation- the location where the file should be downloaded- Throws:
IOException- if an I/O error occurs during the file download
-
deleteDownloadableFiles
public void deleteDownloadableFiles()Deletes all downloadable files.- Specified by:
deleteDownloadableFilesin interfaceorg.openqa.selenium.HasDownloads- Throws:
org.openqa.selenium.WebDriverException- capability to enable downloads must be set
-
fireSessionEvent
Fires a custom session event to the remote server event bus. This allows test code to trigger server-side utilities that subscribe to the event bus.Example usage:
// Simple event driver.fireSessionEvent("test:started"); // Event with payload driver.fireSessionEvent("test:failed", Map.of( "testName", "LoginTest", "error", "Element not found" ));- Parameters:
eventType- the type of event (e.g., "test:failed", "log:collect", "marker:add")payload- optional data to include with the event (maybe null or empty)- Returns:
- the response data from the server
- Throws:
org.openqa.selenium.WebDriverException- if the event cannot be fired
-
fireSessionEvent
Fires a custom session event to the remote server event bus without a payload.- Parameters:
eventType- the type of event (e.g., "test:started", "log:collect")- Returns:
- the response data from the server
- Throws:
org.openqa.selenium.WebDriverException- if the event cannot be fired- See Also:
-
setDelayEnabled
public void setDelayEnabled(boolean enabled) - Specified by:
setDelayEnabledin interfaceorg.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement
-
resetCooldown
public void resetCooldown()- Specified by:
resetCooldownin interfaceorg.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement
-
getFederatedCredentialManagementDialog
public org.openqa.selenium.federatedcredentialmanagement.FederatedCredentialManagementDialog getFederatedCredentialManagementDialog()- Specified by:
getFederatedCredentialManagementDialogin interfaceorg.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement
-
log
protected void log(SessionId sessionId, String commandName, Object toLog, RemoteWebDriver.When when) Override this to be notified at key points in the execution of a command.- Parameters:
sessionId- the session id.commandName- the command that is being executed.toLog- any data that might be interesting.when- verb tense of "Execute" to prefix message
-
getFileDetector
-
setFileDetector
Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing.- Parameters:
detector- The detector to use. Must not be null.- See Also:
-
toString
-
getDownloadedFiles()instead