Skip to content

Class: DriverCore<C, Settings>

@appium/base-driver.DriverCore

Methods and properties which both AppiumDriver and BaseDriver inherit.

This should not be used directly by external code.

Type parameters

Name Type
C extends Constraints
Settings extends StringRecord = StringRecord

Hierarchy

  • DriverCore

BaseDriver

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new DriverCore<C, Settings>(opts?, shouldValidateCaps?)

Type parameters

Name Type
C extends Constraints
Settings extends StringRecord = StringRecord

Parameters

Name Type Default value
opts Object undefined
opts.address string undefined
opts.allowCors NonNullable<undefined | boolean> undefined
opts.allowInsecure AllowInsecureConfig undefined
opts.basePath string undefined
opts.callbackAddress undefined | string undefined
opts.callbackPort number undefined
opts.debugLogSpacing NonNullable<undefined | boolean> undefined
opts.defaultCapabilities undefined | DefaultCapabilitiesConfig undefined
opts.denyInsecure DenyInsecureConfig undefined
opts.driver undefined | DriverConfig undefined
opts.fastReset? boolean undefined
opts.keepAliveTimeout number undefined
opts.localTimezone NonNullable<undefined | boolean> undefined
opts.logFile undefined | string undefined
opts.logFilters undefined | LogFiltersConfig undefined
opts.logNoColors NonNullable<undefined | boolean> undefined
opts.logTimestamp NonNullable<undefined | boolean> undefined
opts.loglevel NonNullable<undefined | LogLevelConfig> undefined
opts.longStacktrace NonNullable<undefined | boolean> undefined
opts.noPermsCheck NonNullable<undefined | boolean> undefined
opts.nodeconfig undefined | NodeconfigConfig undefined
opts.plugin undefined | PluginConfig undefined
opts.port number undefined
opts.relaxedSecurityEnabled NonNullable<undefined | boolean> undefined
opts.sessionOverride NonNullable<undefined | boolean> undefined
opts.skipUninstall? boolean undefined
opts.strictCaps NonNullable<undefined | boolean> undefined
opts.tmpDir undefined | string undefined
opts.traceDir undefined | string undefined
opts.useDrivers UseDriversConfig undefined
opts.usePlugins UsePluginsConfig undefined
opts.webhook undefined | string undefined
shouldValidateCaps boolean true

Defined in

packages/base-driver/lib/basedriver/core.ts:102

Properties

_eventHistory

Protected _eventHistory: EventHistory

Defined in

packages/base-driver/lib/basedriver/core.ts:76


_log

Protected _log: AppiumLogger

Defined in

packages/base-driver/lib/basedriver/core.ts:84


allowInsecure

allowInsecure: string[]

Implementation of

Core.allowInsecure

Defined in

packages/base-driver/lib/basedriver/core.ts:60


basePath

basePath: string

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

Implementation of

Core.basePath

Defined in

packages/base-driver/lib/basedriver/core.ts:56


commandsQueueGuard

Protected commandsQueueGuard: AsyncLock

Defined in

packages/base-driver/lib/basedriver/core.ts:90


denyInsecure

denyInsecure: string[]

Implementation of

Core.denyInsecure

Defined in

packages/base-driver/lib/basedriver/core.ts:62


eventEmitter

eventEmitter: EventEmitter

Implementation of

Core.eventEmitter

Defined in

packages/base-driver/lib/basedriver/core.ts:79


helpers

helpers: DriverHelpers

Implementation of

Core.helpers

Defined in

packages/base-driver/lib/basedriver/core.ts:46


implicitWaitMs

implicitWaitMs: number

Implementation of

Core.implicitWaitMs

Defined in

packages/base-driver/lib/basedriver/core.ts:66


initialOpts

initialOpts: Object

Type declaration

Name Type
address string
allowCors NonNullable<undefined | boolean>
allowInsecure AllowInsecureConfig
basePath string
callbackAddress undefined | string
callbackPort number
debugLogSpacing NonNullable<undefined | boolean>
defaultCapabilities undefined | DefaultCapabilitiesConfig
denyInsecure DenyInsecureConfig
driver undefined | DriverConfig
fastReset? boolean
keepAliveTimeout number
localTimezone NonNullable<undefined | boolean>
logFile undefined | string
logFilters undefined | LogFiltersConfig
logNoColors NonNullable<undefined | boolean>
logTimestamp NonNullable<undefined | boolean>
loglevel NonNullable<undefined | LogLevelConfig>
longStacktrace NonNullable<undefined | boolean>
noPermsCheck NonNullable<undefined | boolean>
nodeconfig undefined | NodeconfigConfig
plugin undefined | PluginConfig
port number
relaxedSecurityEnabled NonNullable<undefined | boolean>
sessionOverride NonNullable<undefined | boolean>
skipUninstall? boolean
strictCaps NonNullable<undefined | boolean>
tmpDir undefined | string
traceDir undefined | string
useDrivers UseDriversConfig
usePlugins UsePluginsConfig
webhook undefined | string

Implementation of

Core.initialOpts

Defined in

packages/base-driver/lib/basedriver/core.ts:44


locatorStrategies

locatorStrategies: string[]

Implementation of

Core.locatorStrategies

Defined in

packages/base-driver/lib/basedriver/core.ts:68


managedDrivers

managedDrivers: Driver<Constraints, StringRecord, StringRecord, DefaultCreateSessionResult<Constraints>, void, StringRecord>[]

Defined in

packages/base-driver/lib/basedriver/core.ts:72


newCommandTimeoutMs

newCommandTimeoutMs: number

Implementation of

Core.newCommandTimeoutMs

Defined in

packages/base-driver/lib/basedriver/core.ts:64


noCommandTimer

noCommandTimer: null | Timeout

Defined in

packages/base-driver/lib/basedriver/core.ts:74


opts

opts: DriverOpts<C>

Implementation of

Core.opts

Defined in

packages/base-driver/lib/basedriver/core.ts:42


protocol

Optional protocol: Protocol

Implementation of

Core.protocol

Defined in

packages/base-driver/lib/basedriver/core.ts:100


relaxedSecurityEnabled

relaxedSecurityEnabled: boolean

Implementation of

Core.relaxedSecurityEnabled

Defined in

packages/base-driver/lib/basedriver/core.ts:58


sessionId

sessionId: null | string

Implementation of

Core.sessionId

Defined in

packages/base-driver/lib/basedriver/core.ts:40


settings

settings: DeviceSettings<Settings>

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

Implementation of

Core.settings

Defined in

packages/base-driver/lib/basedriver/core.ts:98


shouldValidateCaps

shouldValidateCaps: boolean

Implementation of

Core.shouldValidateCaps

Defined in

packages/base-driver/lib/basedriver/core.ts:88


shutdownUnexpectedly

shutdownUnexpectedly: boolean

Defined in

packages/base-driver/lib/basedriver/core.ts:86


webLocatorStrategies

webLocatorStrategies: string[]

Implementation of

Core.webLocatorStrategies

Defined in

packages/base-driver/lib/basedriver/core.ts:70


baseVersion

Static baseVersion: string = 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.ts:38

Accessors

driverData

get driverData(): Object

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

Object

Implementation of

Core.driverData

Defined in

packages/base-driver/lib/basedriver/core.ts:160


eventHistory

get eventHistory(): EventHistory

Returns

EventHistory

Implementation of

Core.eventHistory

Defined in

packages/base-driver/lib/basedriver/core.ts:183


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.

Implementation of

Core.isCommandsQueueEnabled

Defined in

packages/base-driver/lib/basedriver/core.ts:175


log

get log(): AppiumLogger

Returns

AppiumLogger

Implementation of

Core.log

Defined in

packages/base-driver/lib/basedriver/core.ts:137

Methods

addManagedDriver

addManagedDriver(driver): void

Parameters

Name Type
driver Driver<Constraints, StringRecord, StringRecord, DefaultCreateSessionResult<Constraints>, void, StringRecord>

Returns

void

Implementation of

Core.addManagedDriver

Defined in

packages/base-driver/lib/basedriver/core.ts:366


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

Implementation of

Core.assertFeatureEnabled

Defined in

packages/base-driver/lib/basedriver/core.ts:290


canProxy

canProxy(sessionId): boolean

Parameters

Name Type
sessionId string

Returns

boolean

Implementation of

Core.canProxy

Defined in

packages/base-driver/lib/basedriver/core.ts:325


clearNewCommandTimeout

clearNewCommandTimeout(): Promise<void>

Returns

Promise<void>

Implementation of

Core.clearNewCommandTimeout

Defined in

packages/base-driver/lib/basedriver/core.ts:374


driverForSession

driverForSession(sessionId): null | Core<Constraints, StringRecord>

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<Constraints, StringRecord>

Implementation of

Core.driverForSession

Defined in

packages/base-driver/lib/basedriver/core.ts:227


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.ts:280


getManagedDrivers

getManagedDrivers(): Driver<Constraints, StringRecord, StringRecord, DefaultCreateSessionResult<Constraints>, void, StringRecord>[]

Returns

Driver<Constraints, StringRecord, StringRecord, DefaultCreateSessionResult<Constraints>, void, StringRecord>[]

Implementation of

Core.getManagedDrivers

Defined in

packages/base-driver/lib/basedriver/core.ts:370


getProxyAvoidList

getProxyAvoidList(sessionId): RouteMatcher[]

Parameters

Name Type
sessionId string

Returns

RouteMatcher[]

Implementation of

Core.getProxyAvoidList

Defined in

packages/base-driver/lib/basedriver/core.ts:321


getStatus

getStatus(): Promise<{}>

Returns

Promise<{}>

Implementation of

Core.getStatus

Defined in

packages/base-driver/lib/basedriver/core.ts:210


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

Implementation of

Core.isFeatureEnabled

Defined in

packages/base-driver/lib/basedriver/core.ts:252


isMjsonwpProtocol

isMjsonwpProtocol(): boolean

Returns

boolean

Implementation of

Core.isMjsonwpProtocol

Defined in

packages/base-driver/lib/basedriver/core.ts:231


isW3CProtocol

isW3CProtocol(): boolean

Returns

boolean

Implementation of

Core.isW3CProtocol

Defined in

packages/base-driver/lib/basedriver/core.ts:235


logEvent

logEvent(eventName): void

API method for driver developers to log timings for important events

Parameters

Name Type
eventName string

Returns

void

Implementation of

Core.logEvent

Defined in

packages/base-driver/lib/basedriver/core.ts:190


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

Implementation of

Core.onUnexpectedShutdown

Defined in

packages/base-driver/lib/basedriver/core.ts:150


proxyActive

proxyActive(sessionId): boolean

Parameters

Name Type
sessionId string

Returns

boolean

Implementation of

Core.proxyActive

Defined in

packages/base-driver/lib/basedriver/core.ts:317


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

Implementation of

Core.proxyRouteIsAvoided

Defined in

packages/base-driver/lib/basedriver/core.ts:342


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

Implementation of

Core.sessionExists

Defined in

packages/base-driver/lib/basedriver/core.ts:218


setProtocolMJSONWP

setProtocolMJSONWP(): void

Returns

void

Defined in

packages/base-driver/lib/basedriver/core.ts:239


setProtocolW3C

setProtocolW3C(): void

Returns

void

Defined in

packages/base-driver/lib/basedriver/core.ts:243


validateLocatorStrategy

validateLocatorStrategy(strategy, webContext?): void

Parameters

Name Type Default value
strategy string undefined
webContext boolean false

Returns

void

Implementation of

Core.validateLocatorStrategy

Defined in

packages/base-driver/lib/basedriver/core.ts:302