Class: DriverCore<C>
@appium/base-driver.DriverCore
Implements
Type parameters
Name | Type |
---|---|
C |
BaseDriverCapConstraints |
Table of contents
Constructors
Properties
- _eventHistory
- _log
- allowInsecure
- basePath
- commandsQueueGuard
- denyInsecure
- eventEmitter
- helpers
- implicitWaitMs
- initialOpts
- locatorStrategies
- managedDrivers
- newCommandTimeoutMs
- noCommandTimer
- opts
- protocol
- relaxedSecurityEnabled
- sessionId
- settings
- shouldValidateCaps
- shutdownUnexpectedly
- webLocatorStrategies
- baseVersion
- executeMethodMap
Accessors
Methods
- addManagedDriver
- assertFeatureEnabled
- canProxy
- clearNewCommandTimeout
- driverForSession
- ensureFeatureEnabled
- getManagedDrivers
- getProxyAvoidList
- getStatus
- isFeatureEnabled
- isMjsonwpProtocol
- isW3CProtocol
- logEvent
- onUnexpectedShutdown
- proxyActive
- proxyRouteIsAvoided
- sessionExists
- setProtocolMJSONWP
- setProtocolW3C
- validateLocatorStrategy
Constructors
constructor
• new DriverCore<C
>(opts?
, shouldValidateCaps?
)
Type parameters
Name | Type |
---|---|
C |
extends Readonly <Record <string , Constraint >> = typeof BASE_DESIRED_CAP_CONSTRAINTS |
Parameters
Name | Type | Default value |
---|---|---|
opts |
DriverOpts <C > |
undefined |
shouldValidateCaps? |
boolean |
true |
Defined in
packages/base-driver/lib/basedriver/core.js:125
Properties
_eventHistory
• _eventHistory: EventHistory
Defined in
packages/base-driver/lib/basedriver/core.js:87
_log
• _log: AppiumLogger
Defined in
packages/base-driver/lib/basedriver/core.js:96
allowInsecure
• allowInsecure: string
[] = []
Defined in
packages/base-driver/lib/basedriver/core.js:65
basePath
• basePath: string
= DEFAULT_BASE_PATH
basePath is used for several purposes, for example in setting up proxying to other drivers, since we need to know what the base path of any incoming request might look like. We set it to the default initially but it is automatically updated during any actual program execution by the routeConfiguringFunction, which is necessarily run as the entrypoint for any Appium server
Defined in
packages/base-driver/lib/basedriver/core.js:60
commandsQueueGuard
• Protected
commandsQueueGuard: AsyncLock
Defined in
packages/base-driver/lib/basedriver/core.js:111
denyInsecure
• denyInsecure: string
[] = []
Defined in
packages/base-driver/lib/basedriver/core.js:68
eventEmitter
• eventEmitter: EventEmitter
Defined in
packages/base-driver/lib/basedriver/core.js:91
helpers
• helpers: DriverHelpers
<any
> = helpers
Defined in
packages/base-driver/lib/basedriver/core.js:50
implicitWaitMs
• implicitWaitMs: number
= 0
Defined in
packages/base-driver/lib/basedriver/core.js:72
initialOpts
• initialOpts: ServerArgs
Defined in
packages/base-driver/lib/basedriver/core.js:48
locatorStrategies
• locatorStrategies: string
[] = []
Defined in
packages/base-driver/lib/basedriver/core.js:75
managedDrivers
• managedDrivers: Driver
<typeof BASE_DESIRED_CAP_CONSTRAINTS
, StringRecord
, any
>[] = []
Defined in
packages/base-driver/lib/basedriver/core.js:81
newCommandTimeoutMs
• newCommandTimeoutMs: number
= NEW_COMMAND_TIMEOUT_MS
Defined in
packages/base-driver/lib/basedriver/core.js:70
noCommandTimer
• noCommandTimer: null
| Timeout
= null
Defined in
packages/base-driver/lib/basedriver/core.js:84
opts
• opts: DriverOpts
<C
>
Defined in
packages/base-driver/lib/basedriver/core.js:43
protocol
• protocol: undefined
| string
Defined in
packages/base-driver/lib/basedriver/core.js:254
packages/base-driver/lib/basedriver/core.js:258
relaxedSecurityEnabled
• relaxedSecurityEnabled: boolean
= false
Defined in
packages/base-driver/lib/basedriver/core.js:62
sessionId
• sessionId: null
| string
= null
Defined in
packages/base-driver/lib/basedriver/core.js:38
settings
• settings: DeviceSettings
<any
>
settings should be instantiated by drivers which extend BaseDriver, but we set it to an empty DeviceSettings instance here to make sure that the default settings are applied even if an extending driver doesn't utilize the settings functionality itself
Defined in
packages/base-driver/lib/basedriver/core.js:119
shouldValidateCaps
• shouldValidateCaps: boolean
Defined in
packages/base-driver/lib/basedriver/core.js:106
shutdownUnexpectedly
• Protected
shutdownUnexpectedly: boolean
= false
Defined in
packages/base-driver/lib/basedriver/core.js:101
webLocatorStrategies
• webLocatorStrategies: string
[] = []
Defined in
packages/base-driver/lib/basedriver/core.js:78
baseVersion
▪ Static
baseVersion: any
= BASEDRIVER_VER
Make the basedriver version available so for any driver which inherits from this package, we know which version of basedriver it inherited from
Defined in
packages/base-driver/lib/basedriver/core.js:30
executeMethodMap
▪ Static
executeMethodMap: Readonly
<Record
<string
, Readonly
<ExecuteMethodDef
<DriverCore
<typeof BASE_DESIRED_CAP_CONSTRAINTS
>>>>> = {}
Defined in
packages/base-driver/lib/basedriver/core.js:33
Accessors
driverData
• get
driverData(): Record
<string
, unknown
>
This property is used by AppiumDriver to store the data of the specific driver sessions. This data can be later used to adjust properties for driver instances running in parallel. Override it in inherited driver classes if necessary.
Returns
Record
<string
, unknown
>
Driver properties mapping
Defined in
packages/base-driver/lib/basedriver/core.js:169
eventHistory
• get
eventHistory(): EventHistory
Returns
Defined in
packages/base-driver/lib/basedriver/core.js:192
isCommandsQueueEnabled
• get
isCommandsQueueEnabled(): boolean
This property controls the way the executeCommand
method
handles new driver commands received from the client.
Override it for inherited classes only in special cases.
Returns
boolean
If the returned value is true (default) then all the commands received by the particular driver instance are going to be put into the queue, so each following command will not be executed until the previous command execution is completed. False value disables that queue, so each driver command is executed independently and does not wait for anything.
Defined in
packages/base-driver/lib/basedriver/core.js:184
log
• get
log(): AppiumLogger
Returns
Defined in
packages/base-driver/lib/basedriver/core.js:144
Methods
addManagedDriver
▸ addManagedDriver(driver
): void
Parameters
Name | Type |
---|---|
driver |
Driver <typeof BASE_DESIRED_CAP_CONSTRAINTS , StringRecord , any > |
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:402
assertFeatureEnabled
▸ assertFeatureEnabled(name
): void
Assert that a given feature is enabled and throw a helpful error if it's not
Parameters
Name | Type | Description |
---|---|---|
name |
string |
name of feature/command |
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:306
canProxy
▸ canProxy(sessionId?
): boolean
Parameters
Name | Type |
---|---|
sessionId? |
string |
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:361
clearNewCommandTimeout
▸ clearNewCommandTimeout(): Promise
<void
>
Returns
Promise
<void
>
Defined in
packages/base-driver/lib/basedriver/core.js:410
driverForSession
▸ driverForSession(sessionId
): null
| Core
<C
>
method required by MJSONWP in order to determine if the command should be proxied directly to the driver
Parameters
Name | Type |
---|---|
sessionId |
string |
Returns
null
| Core
<C
>
Defined in
packages/base-driver/lib/basedriver/core.js:241
ensureFeatureEnabled
▸ ensureFeatureEnabled(name
): void
Assert that a given feature is enabled and throw a helpful error if it's not
Deprecated
Parameters
Name | Type | Description |
---|---|---|
name |
string |
name of feature/command |
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:296
getManagedDrivers
▸ getManagedDrivers(): Driver
<typeof BASE_DESIRED_CAP_CONSTRAINTS
, StringRecord
, any
>[]
Returns
Driver
<typeof BASE_DESIRED_CAP_CONSTRAINTS
, StringRecord
, any
>[]
Defined in
packages/base-driver/lib/basedriver/core.js:406
getProxyAvoidList
▸ getProxyAvoidList(sessionId
): RouteMatcher
[]
Parameters
Name | Type |
---|---|
sessionId |
string |
Returns
Defined in
packages/base-driver/lib/basedriver/core.js:352
getStatus
▸ getStatus(): Promise
<{}>
Returns
Promise
<{}>
Defined in
packages/base-driver/lib/basedriver/core.js:220
isFeatureEnabled
▸ isFeatureEnabled(name
): boolean
Check whether a given feature is enabled via its name
Parameters
Name | Type | Description |
---|---|---|
name |
string |
name of feature/command |
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:268
isMjsonwpProtocol
▸ isMjsonwpProtocol(): boolean
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:245
isW3CProtocol
▸ isW3CProtocol(): boolean
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:249
logEvent
▸ logEvent(eventName
): void
API method for driver developers to log timings for important events
Parameters
Name | Type |
---|---|
eventName |
string |
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:200
onUnexpectedShutdown
▸ onUnexpectedShutdown(handler
): void
Set a callback handler if needed to execute a custom piece of code when the driver is shut down unexpectedly. Multiple calls to this method will cause the handler to be executed mutiple times
Parameters
Name | Type | Description |
---|---|---|
handler |
(...args : any []) => void |
The code to be executed on unexpected shutdown. The function may accept one argument, which is the actual error instance, which caused the driver to shut down. |
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:157
proxyActive
▸ proxyActive(sessionId?
): boolean
Parameters
Name | Type |
---|---|
sessionId? |
string |
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:343
proxyRouteIsAvoided
▸ proxyRouteIsAvoided(sessionId
, method
, url
, body?
): boolean
Whether a given command route (expressed as method and url) should not be proxied according to this driver
Parameters
Name | Type | Description |
---|---|---|
sessionId |
string |
the current sessionId (in case the driver runs multiple session ids and requires it). This is not used in this method but should be made available to overridden methods. |
method |
HTTPMethod |
HTTP method of the route |
url |
string |
url of the route |
body? |
any |
webdriver request body |
Returns
boolean
- whether the route should be avoided
Defined in
packages/base-driver/lib/basedriver/core.js:378
sessionExists
▸ sessionExists(sessionId?
): boolean
method required by MJSONWP in order to determine whether it should respond with an invalid session response
Parameters
Name | Type |
---|---|
sessionId? |
string |
Returns
boolean
Defined in
packages/base-driver/lib/basedriver/core.js:230
setProtocolMJSONWP
▸ setProtocolMJSONWP(): void
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:253
setProtocolW3C
▸ setProtocolW3C(): void
Returns
void
Defined in
packages/base-driver/lib/basedriver/core.js:257
validateLocatorStrategy
▸ validateLocatorStrategy(strategy
, webContext?
): void
Parameters
Name | Type | Default value |
---|---|---|
strategy |
string |
undefined |
webContext? |
boolean |
false |
Returns
void