public final class AppiumDriverLocalService
extends org.openqa.selenium.remote.service.DriverService
Modifier and Type | Method and Description |
---|---|
void |
addLogMessageConsumer(java.util.function.Consumer<java.lang.String> consumer)
When a complete log message is available (from server output data), the
specified
Consumer is invoked with that log message. |
void |
addOutPutStream(java.io.OutputStream outputStream)
Adds other output stream which should accept server output data.
|
void |
addOutPutStreams(java.util.List<java.io.OutputStream> outputStreams)
Adds other output streams which should accept server output data.
|
void |
addSlf4jLogMessageConsumer(java.util.function.BiConsumer<java.lang.String,Slf4jLogMessageContext> slf4jLogMessageConsumer)
When a complete log message is available (from server output data) that
message is parsed for its slf4j context (logger name, logger level etc.)
and the specified
BiConsumer is invoked with the log message and
slf4j context. |
static AppiumDriverLocalService |
buildDefaultService() |
static AppiumDriverLocalService |
buildService(AppiumServiceBuilder builder) |
boolean |
clearOutPutStreams()
Remove all existing server output streams.
|
void |
enableDefaultSlf4jLoggingOfOutputData()
Enables server output data logging through
SLF4J loggers.
|
java.lang.String |
getBasePath() |
java.lang.String |
getStdOut()
Logs as string.
|
java.net.URL |
getUrl()
Base URL.
|
boolean |
isRunning() |
java.util.Optional<java.io.OutputStream> |
removeOutPutStream(java.io.OutputStream outputStream)
Remove the outputStream which is receiving server output data.
|
void |
start()
Starts the defined appium server.
|
void |
stop()
Stops this service is it is currently running.
|
AppiumDriverLocalService |
withBasePath(java.lang.String basePath) |
public static AppiumDriverLocalService buildDefaultService()
public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder)
public AppiumDriverLocalService withBasePath(java.lang.String basePath)
public java.lang.String getBasePath()
public java.net.URL getUrl()
getUrl
in class org.openqa.selenium.remote.service.DriverService
public boolean isRunning()
isRunning
in class org.openqa.selenium.remote.service.DriverService
public void start() throws AppiumServerHasNotBeenStartedLocallyException
start
in class org.openqa.selenium.remote.service.DriverService
AppiumServerHasNotBeenStartedLocallyException
- If an error occurs while spawning the child process.stop()
public void stop()
stop
in class org.openqa.selenium.remote.service.DriverService
start()
@Nullable public java.lang.String getStdOut()
public void addOutPutStream(java.io.OutputStream outputStream)
outputStream
- is an instance of OutputStream
that is ready to accept server outputpublic void addOutPutStreams(java.util.List<java.io.OutputStream> outputStreams)
outputStreams
- is a list of additional OutputStream
that are ready to accept server outputpublic java.util.Optional<java.io.OutputStream> removeOutPutStream(java.io.OutputStream outputStream)
public boolean clearOutPutStreams()
public void enableDefaultSlf4jLoggingOfOutputData()
NOTE1: You might want to call method clearOutPutStreams()
before
calling this method.
NOTE2: it is required that --log-timestamp
server flag is
false
.
By default log messages are:
INFO
level, unless log message is pre-fixed by
[debug]
then logged at DEBUG
level.appium.service.adb
at level INFO
.
appium.service.xcuitest
at level
DEBUG
.
addSlf4jLogMessageConsumer(BiConsumer)
public void addSlf4jLogMessageConsumer(java.util.function.BiConsumer<java.lang.String,Slf4jLogMessageContext> slf4jLogMessageConsumer)
BiConsumer
is invoked with the log message and
slf4j context.
Use this method only if you want a behavior that differentiates from the
default behavior as enabled by method
enableDefaultSlf4jLoggingOfOutputData()
.
NOTE: You might want to call method clearOutPutStreams()
before
calling this method.
implementation detail:
[debug]
then log level is set to
DEBUG
, otherwise log level is INFO
.appium.service.adb
at level INFO
appium.service.xcuitest
at level DEBUG
slf4jLogMessageConsumer
- BiConsumer block to be executed when a log message is
available.public void addLogMessageConsumer(java.util.function.Consumer<java.lang.String> consumer)
Consumer
is invoked with that log message.
NOTE: You might want to call method clearOutPutStreams()
before
calling this method.
If the Consumer fails and throws an exception the exception is logged (at
WARN level) and execution continues.
consumer
- Consumer block to be executed when a log message is available.