Class: BaseDriver<C, CArgs, Settings, CreateResult, DeleteResult, SessionData>
@appium/base-driver.BaseDriver
BaseDriver
implements this. It contains default behavior;
external drivers are expected to implement ExternalDriver instead.
C
should be the constraints of the driver.
CArgs
would be the shape of cliArgs
.
Settings
is the shape of the raw device settings object (see IDeviceSettings)
Type parameters
Name | Type |
---|---|
C |
extends Constraints |
CArgs |
extends StringRecord = StringRecord |
Settings |
extends StringRecord = StringRecord |
CreateResult |
DefaultCreateSessionResult <C > |
DeleteResult |
DefaultDeleteSessionResult |
SessionData |
extends StringRecord = StringRecord |
Hierarchy
↳ BaseDriver
Implements
Driver
<C
,CArgs
,Settings
,CreateResult
,DeleteResult
,SessionData
>
Table of contents
Constructors
Properties
- _eventHistory
- _log
- allowInsecure
- basePath
- caps
- cliArgs
- commandsQueueGuard
- denyInsecure
- desiredCapConstraints
- eventEmitter
- helpers
- implicitWaitMs
- initialOpts
- locatorStrategies
- managedDrivers
- newCommandTimeoutMs
- noCommandTimer
- opts
- originalCaps
- protocol
- relaxedSecurityEnabled
- server
- serverHost
- serverPath
- serverPort
- sessionId
- settings
- shouldValidateCaps
- shutdownUnexpectedly
- supportedLogTypes
- webLocatorStrategies
- baseVersion
Accessors
Methods
- addManagedDriver
- assertFeatureEnabled
- assignServer
- canProxy
- clearNewCommandTimeout
- createSession
- deleteSession
- driverForSession
- ensureFeatureEnabled
- executeCommand
- executeMethod
- findElOrEls
- findElOrElsWithProcessing
- findElement
- findElementFromElement
- findElementFromShadowRoot
- findElements
- findElementsFromElement
- findElementsFromShadowRoot
- getLog
- getLogEvents
- getLogTypes
- getManagedDrivers
- getPageSource
- getProxyAvoidList
- getSession
- getSessions
- getSettings
- getStatus
- getTimeouts
- implicitWait
- implicitWaitForCondition
- implicitWaitMJSONWP
- implicitWaitW3C
- isFeatureEnabled
- isMjsonwpProtocol
- isW3CProtocol
- logCustomEvent
- logEvent
- logExtraCaps
- newCommandTimeout
- onUnexpectedShutdown
- pageLoadTimeoutMJSONWP
- pageLoadTimeoutW3C
- parseTimeoutArgument
- proxyActive
- proxyRouteIsAvoided
- reset
- scriptTimeoutMJSONWP
- scriptTimeoutW3C
- sessionExists
- setImplicitWait
- setNewCommandTimeout
- setProtocolMJSONWP
- setProtocolW3C
- startNewCommandTimeout
- startUnexpectedShutdown
- timeouts
- updateSettings
- validateDesiredCaps
- validateLocatorStrategy
Constructors
constructor
• new BaseDriver<C
, CArgs
, Settings
, CreateResult
, DeleteResult
, SessionData
>(opts
, shouldValidateCaps?
)
Type parameters
Name | Type |
---|---|
C |
extends Constraints |
CArgs |
extends StringRecord = StringRecord |
Settings |
extends StringRecord = StringRecord |
CreateResult |
DefaultCreateSessionResult <C > |
DeleteResult |
void |
SessionData |
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 |
Overrides
Defined in
packages/base-driver/lib/basedriver/driver.ts:54
Properties
_eventHistory
• Protected
_eventHistory: EventHistory
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:76
_log
• Protected
_log: AppiumLogger
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:84
allowInsecure
• allowInsecure: string
[]
Implementation of
Inherited from
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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:56
caps
• caps: DriverCaps
<C
>
The processed capabilities used to start the session represented by the current driver instance
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:46
cliArgs
• cliArgs: CArgs
& ServerArgs
The set of command line arguments set for this driver
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:45
commandsQueueGuard
• Protected
commandsQueueGuard: AsyncLock
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:90
denyInsecure
• denyInsecure: string
[]
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:62
desiredCapConstraints
• desiredCapConstraints: C
The constraints object used to validate capabilities
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:48
eventEmitter
• eventEmitter: EventEmitter
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:79
helpers
• helpers: DriverHelpers
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:46
implicitWaitMs
• implicitWaitMs: number
Implementation of
Inherited from
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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:44
locatorStrategies
• locatorStrategies: string
[]
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:68
managedDrivers
• managedDrivers: Driver
<Constraints
, StringRecord
, StringRecord
, DefaultCreateSessionResult
<Constraints
>, void
, StringRecord
>[]
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:72
newCommandTimeoutMs
• newCommandTimeoutMs: number
Implementation of
Inherited from
DriverCore.newCommandTimeoutMs
Defined in
packages/base-driver/lib/basedriver/core.ts:64
noCommandTimer
• noCommandTimer: null
| Timeout
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:74
opts
• opts: DriverOpts
<C
>
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:42
originalCaps
• originalCaps: W3CDriverCaps
<C
>
The original capabilities used to start the session represented by the current driver instance
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:47
protocol
• Optional
protocol: Protocol
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:100
relaxedSecurityEnabled
• relaxedSecurityEnabled: boolean
Implementation of
Inherited from
DriverCore.relaxedSecurityEnabled
Defined in
packages/base-driver/lib/basedriver/core.ts:58
server
• Optional
server: AppiumServer
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:49
serverHost
• Optional
serverHost: string
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:50
serverPath
• Optional
serverPath: string
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:52
serverPort
• Optional
serverPort: number
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:51
sessionId
• sessionId: null
| string
Implementation of
Inherited from
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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:98
shouldValidateCaps
• shouldValidateCaps: boolean
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:88
shutdownUnexpectedly
• shutdownUnexpectedly: boolean
Inherited from
DriverCore.shutdownUnexpectedly
Defined in
packages/base-driver/lib/basedriver/core.ts:86
supportedLogTypes
• supportedLogTypes: Readonly
<LogDefRecord
>
Definition of the available log types
Implementation of
Inherited from
ILogCommands.supportedLogTypes
Defined in
packages/types/build/lib/driver.d.ts:269
webLocatorStrategies
• webLocatorStrategies: string
[]
Implementation of
Inherited from
DriverCore.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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:38
Accessors
_desiredCapConstraints
• Protected
get
_desiredCapConstraints(): Readonly
<{ app
: { isString
: true
} ; autoLaunch
: { isBoolean
: true
} ; autoWebview
: { isBoolean
: true
} ; automationName
: { isString
: true
} ; eventTimings
: { isBoolean
: true
} ; fullReset
: { isBoolean
: true
} ; language
: { isString
: true
} ; locale
: { isString
: true
} ; newCommandTimeout
: { isNumber
: true
} ; noReset
: { isBoolean
: true
} ; orientation
: { inclusion
: readonly ["LANDSCAPE"
, "PORTRAIT"
] } ; platformName
: { isString
: true
; presence
: true
} ; platformVersion
: { isString
: true
} ; printPageSourceOnFindFailure
: { isBoolean
: true
} ; udid
: { isString
: true
} ; webSocketUrl
: { isBoolean
: true
} } & C
>
Contains the base constraints plus whatever the subclass wants to add.
Subclasses shouldn't need to use this. If you need to use this, please create an issue:
See
https://github.com/appium/appium/issues/new
Returns
Readonly
<{ app
: { isString
: true
} ; autoLaunch
: { isBoolean
: true
} ; autoWebview
: { isBoolean
: true
} ; automationName
: { isString
: true
} ; eventTimings
: { isBoolean
: true
} ; fullReset
: { isBoolean
: true
} ; language
: { isString
: true
} ; locale
: { isString
: true
} ; newCommandTimeout
: { isNumber
: true
} ; noReset
: { isBoolean
: true
} ; orientation
: { inclusion
: readonly ["LANDSCAPE"
, "PORTRAIT"
] } ; platformName
: { isString
: true
; presence
: true
} ; platformVersion
: { isString
: true
} ; printPageSourceOnFindFailure
: { isBoolean
: true
} ; udid
: { isString
: true
} ; webSocketUrl
: { isBoolean
: true
} } & C
>
Defined in
packages/base-driver/lib/basedriver/driver.ts:69
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
Inherited from
DriverCore.driverData
Defined in
packages/base-driver/lib/basedriver/core.ts:160
eventHistory
• get
eventHistory(): EventHistory
Returns
Implementation of
Inherited from
DriverCore.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
Inherited from
DriverCore.isCommandsQueueEnabled
Defined in
packages/base-driver/lib/basedriver/core.ts:175
log
• get
log(): AppiumLogger
Returns
Implementation of
Inherited from
DriverCore.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
Inherited from
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
Inherited from
DriverCore.assertFeatureEnabled
Defined in
packages/base-driver/lib/basedriver/core.ts:290
assignServer
▸ assignServer(server
, host
, port
, path
): void
A helper function used to assign server information to the driver instance so the driver knows where the server is Running
Parameters
Name | Type | Description |
---|---|---|
server |
AppiumServer |
the server object |
host |
string |
the server hostname |
port |
number |
the server port |
path |
string |
the server base url |
Returns
void
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:184
canProxy
▸ canProxy(sessionId
): boolean
Parameters
Name | Type |
---|---|
sessionId |
string |
Returns
boolean
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:325
clearNewCommandTimeout
▸ clearNewCommandTimeout(): Promise
<void
>
Returns
Promise
<void
>
Implementation of
Inherited from
DriverCore.clearNewCommandTimeout
Defined in
packages/base-driver/lib/basedriver/core.ts:374
createSession
▸ createSession(w3cCapabilities1
, w3cCapabilities2?
, w3cCapabilities?
, driverData?
): Promise
<CreateResult
>
Historically the first two arguments were reserved for JSONWP capabilities. Appium 2 has dropped the support of these, so now we only accept capability objects in W3C format and thus allow any of the three arguments to represent the latter.
Parameters
Name | Type |
---|---|
w3cCapabilities1 |
W3CDriverCaps <C > |
w3cCapabilities2? |
W3CDriverCaps <C > |
w3cCapabilities? |
W3CDriverCaps <C > |
driverData? |
DriverData [] |
Returns
Promise
<CreateResult
>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:232
deleteSession
▸ deleteSession(sessionId?
): Promise
<void
>
Stop an automation session
See
https://w3c.github.io/webdriver/#delete-session
Parameters
Name | Type | Description |
---|---|---|
sessionId? |
null | string |
the id of the session that is to be deleted |
Returns
Promise
<void
>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:340
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
Inherited from
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
Inherited from
DriverCore.ensureFeatureEnabled
Defined in
packages/base-driver/lib/basedriver/core.ts:280
executeCommand
▸ executeCommand<T
>(cmd
, ...args
): Promise
<T
>
This is the main command handler for the driver. It wraps command execution with timeout logic, checking that we have a valid session, and ensuring that we execute commands one at a time. This method is called by MJSONWP's express router.
Type parameters
Name | Type |
---|---|
T |
unknown |
Parameters
Name | Type |
---|---|
cmd |
string |
...args |
any [] |
Returns
Promise
<T
>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:79
executeMethod
▸ executeMethod<TArgs
, TReturn
>(script
, args
): Promise
<TReturn
>
Call an Execute Method
by its name with the given arguments. This method will check that the
driver has registered the method matching the name, and send it the arguments.
Type parameters
Name | Type |
---|---|
TArgs |
extends readonly any [] | readonly [StringRecord <unknown >] = unknown [] |
TReturn |
unknown |
Parameters
Name | Type | Description |
---|---|---|
script |
string |
the name of the Execute Method |
args |
TArgs |
a singleton array containing an arguments object |
Returns
Promise
<TReturn
>
The result of calling the Execute Method
Implementation of
Inherited from
IExecuteCommands.executeMethod
Defined in
packages/types/build/lib/driver.d.ts:148
findElOrEls
▸ findElOrEls(strategy
, selector
, mult
, context?
): Promise
<Element
<string
>[]>
A helper method that returns one or more UI elements based on the search criteria
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector |
mult |
true |
whether or not we want to find multiple elements |
context? |
any |
the element to use as the search context basis if desiredCapabilities |
Returns
Promise
<Element
<string
>[]>
A single element or list of elements
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:242
▸ findElOrEls(strategy
, selector
, mult
, context?
): Promise
<Element
<string
>>
Parameters
Name | Type |
---|---|
strategy |
string |
selector |
string |
mult |
false |
context? |
any |
Returns
Promise
<Element
<string
>>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:243
findElOrElsWithProcessing
▸ findElOrElsWithProcessing(strategy
, selector
, mult
, context?
): Promise
<Element
<string
>[]>
This is a wrapper for findElOrEls
that validates locator strategies
and implements the appium:printPageSourceOnFindFailure
capability
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector |
mult |
true |
whether or not we want to find multiple elements |
context? |
any |
the element to use as the search context basis if desiredCapabilities |
Returns
Promise
<Element
<string
>[]>
A single element or list of elements
Implementation of
Driver.findElOrElsWithProcessing
Inherited from
IFindCommands.findElOrElsWithProcessing
Defined in
packages/types/build/lib/driver.d.ts:255
▸ findElOrElsWithProcessing(strategy
, selector
, mult
, context?
): Promise
<Element
<string
>>
Parameters
Name | Type |
---|---|
strategy |
string |
selector |
string |
mult |
false |
context? |
any |
Returns
Promise
<Element
<string
>>
Implementation of
Driver.findElOrElsWithProcessing
Inherited from
IFindCommands.findElOrElsWithProcessing
Defined in
packages/types/build/lib/driver.d.ts:256
findElement
▸ findElement(strategy
, selector
): Promise
<Element
<string
>>
Find a UI element given a locator strategy and a selector, erroring if it can't be found
See
https://w3c.github.io/webdriver/#find-element
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific element |
Returns
Promise
<Element
<string
>>
The element object encoding the element id which can be used in element-related commands
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:176
findElementFromElement
▸ findElementFromElement(strategy
, selector
, elementId
): Promise
<Element
<string
>>
Find a UI element given a locator strategy and a selector, erroring if it can't be found. Only look for elements among the set of descendants of a given element
See
https://w3c.github.io/webdriver/#find-element-from-element
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific element |
elementId |
string |
the id of the element to use as the search basis |
Returns
Promise
<Element
<string
>>
The element object encoding the element id which can be used in element-related commands
Implementation of
Inherited from
IFindCommands.findElementFromElement
Defined in
packages/types/build/lib/driver.d.ts:199
findElementFromShadowRoot
▸ Optional
findElementFromShadowRoot(strategy
, selector
, shadowId
): Promise
<Element
<string
>>
Find an element from a shadow root
See
https://w3c.github.io/webdriver/#find-element-from-shadow-root
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific elements |
shadowId |
string |
the id of the element to use as the search basis |
Returns
Promise
<Element
<string
>>
The element inside the shadow root matching the selector
Implementation of
Driver.findElementFromShadowRoot
Inherited from
IFindCommands.findElementFromShadowRoot
Defined in
packages/types/build/lib/driver.d.ts:221
findElements
▸ findElements(strategy
, selector
): Promise
<Element
<string
>[]>
Find a a list of all UI elements matching a given a locator strategy and a selector
See
https://w3c.github.io/webdriver/#find-elements
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific elements |
Returns
Promise
<Element
<string
>[]>
A possibly-empty list of element objects
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:186
findElementsFromElement
▸ findElementsFromElement(strategy
, selector
, elementId
): Promise
<Element
<string
>[]>
Find a a list of all UI elements matching a given a locator strategy and a selector. Only look for elements among the set of descendants of a given element
See
https://w3c.github.io/webdriver/#find-elements-from-element
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific elements |
elementId |
string |
the id of the element to use as the search basis |
Returns
Promise
<Element
<string
>[]>
A possibly-empty list of element objects
Implementation of
Driver.findElementsFromElement
Inherited from
IFindCommands.findElementsFromElement
Defined in
packages/types/build/lib/driver.d.ts:211
findElementsFromShadowRoot
▸ Optional
findElementsFromShadowRoot(strategy
, selector
, shadowId
): Promise
<Element
<string
>[]>
Find elements from a shadow root
See
https://w3c.github.io/webdriver/#find-element-from-shadow-root
Parameters
Name | Type | Description |
---|---|---|
strategy |
string |
the locator strategy |
selector |
string |
the selector to combine with the strategy to find the specific elements |
shadowId |
string |
the id of the element to use as the search basis |
Returns
Promise
<Element
<string
>[]>
A possibly empty list of elements inside the shadow root matching the selector
Implementation of
Driver.findElementsFromShadowRoot
Inherited from
IFindCommands.findElementsFromShadowRoot
Defined in
packages/types/build/lib/driver.d.ts:231
getLog
▸ getLog(logType
): Promise
<any
>
Get the log for a given log type.
Parameters
Name | Type | Description |
---|---|---|
logType |
string |
Name/key of log type as defined in ILogCommands.supportedLogTypes. |
Returns
Promise
<any
>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:279
getLogEvents
▸ getLogEvents(type?
): Promise
<EventHistory
| Record
<string
, number
>>
Get a list of events that have occurred in the current session
Parameters
Name | Type | Description |
---|---|---|
type? |
string | string [] |
filter the returned events by including one or more types |
Returns
Promise
<EventHistory
| Record
<string
, number
>>
The event history for the session
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:136
getLogTypes
▸ getLogTypes(): Promise
<string
[]>
Get available log types as a list of strings
Returns
Promise
<string
[]>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:273
getManagedDrivers
▸ getManagedDrivers(): Driver
<Constraints
, StringRecord
, StringRecord
, DefaultCreateSessionResult
<Constraints
>, void
, StringRecord
>[]
Returns
Driver
<Constraints
, StringRecord
, StringRecord
, DefaultCreateSessionResult
<Constraints
>, void
, StringRecord
>[]
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:370
getPageSource
▸ getPageSource(): Promise
<string
>
Get the current page/app source as HTML/XML
See
https://w3c.github.io/webdriver/#get-page-source
Returns
Promise
<string
>
The UI hierarchy in a platform-appropriate format (e.g., HTML for a web page)
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:263
getProxyAvoidList
▸ getProxyAvoidList(sessionId
): RouteMatcher
[]
Parameters
Name | Type |
---|---|
sessionId |
string |
Returns
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:321
getSession
▸ getSession(): Promise
<SingularSessionData
<C
, SessionData
>>
Returns capabilities for the session and event history (if applicable)
Returns
Promise
<SingularSessionData
<C
, SessionData
>>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:333
getSessions
▸ getSessions(): Promise
<MultiSessionData
<C
>[]>
Get data for all sessions running on an Appium server
Returns
Promise
<MultiSessionData
<C
>[]>
A list of session data objects
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:317
getSettings
▸ getSettings(): Promise
<Settings
>
Get the current settings for the session
Returns
Promise
<Settings
>
The settings object
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:394
getStatus
▸ getStatus(): Promise
<{}>
Returns
Promise
<{}>
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:210
getTimeouts
▸ getTimeouts(): Promise
<Record
<string
, number
>>
Get the current timeouts
See
https://w3c.github.io/webdriver/#get-timeouts
Returns
Promise
<Record
<string
, number
>>
A map of timeout names to ms values
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:66
implicitWait
▸ implicitWait(ms
): Promise
<void
>
Set the implicit wait timeout
Deprecated
Use timeouts
instead
Parameters
Name | Type | Description |
---|---|---|
ms |
string | number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:45
implicitWaitForCondition
▸ implicitWaitForCondition(condition
): Promise
<unknown
>
Periodically retry an async function up until the currently set implicit wait timeout
Parameters
Name | Type | Description |
---|---|---|
condition |
(...args : any []) => Promise <any > |
the behaviour to retry until it returns truthy |
Returns
Promise
<unknown
>
The return value of the condition
Implementation of
Driver.implicitWaitForCondition
Inherited from
ITimeoutCommands.implicitWaitForCondition
Defined in
packages/types/build/lib/driver.d.ts:59
implicitWaitMJSONWP
▸ implicitWaitMJSONWP(ms
): Promise
<void
>
Set the implicit wait value that was sent in via the JSONWP
Deprecated
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.implicitWaitMJSONWP
Defined in
packages/types/build/lib/driver.d.ts:79
implicitWaitW3C
▸ implicitWaitW3C(ms
): Promise
<void
>
Set the implicit wait value that was sent in via the W3C protocol
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.implicitWaitW3C
Defined in
packages/types/build/lib/driver.d.ts:72
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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:252
isMjsonwpProtocol
▸ isMjsonwpProtocol(): boolean
Returns
boolean
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:231
isW3CProtocol
▸ isW3CProtocol(): boolean
Returns
boolean
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:235
logCustomEvent
▸ logCustomEvent(vendor
, event
): Promise
<void
>
Add a custom-named event to the Appium event log
Parameters
Name | Type | Description |
---|---|---|
vendor |
string |
the name of the vendor or tool the event belongs to, to namespace the event |
event |
string |
the name of the event itself |
Returns
Promise
<void
>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:128
logEvent
▸ logEvent(eventName
): void
API method for driver developers to log timings for important events
Parameters
Name | Type |
---|---|
eventName |
string |
Returns
void
Implementation of
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:190
logExtraCaps
▸ logExtraCaps(caps
): void
A helper function to log unrecognized capabilities to the console
Params
caps - the capabilities
Parameters
Name | Type |
---|---|
caps |
ConstraintsToCaps <C > |
Returns
void
Defined in
packages/base-driver/lib/basedriver/driver.ts:354
newCommandTimeout
▸ newCommandTimeout(ms
): Promise
<void
>
Set Appium's new command timeout
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.newCommandTimeout
Defined in
packages/types/build/lib/driver.d.ts:111
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
Inherited from
DriverCore.onUnexpectedShutdown
Defined in
packages/base-driver/lib/basedriver/core.ts:150
pageLoadTimeoutMJSONWP
▸ pageLoadTimeoutMJSONWP(ms
): Promise
<void
>
Set the page load timeout value that was sent in via the JSONWP
Deprecated
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.pageLoadTimeoutMJSONWP
Defined in
packages/types/build/lib/driver.d.ts:92
pageLoadTimeoutW3C
▸ pageLoadTimeoutW3C(ms
): Promise
<void
>
Set the page load timeout value that was sent in via the W3C protocol
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.pageLoadTimeoutW3C
Defined in
packages/types/build/lib/driver.d.ts:85
parseTimeoutArgument
▸ parseTimeoutArgument(ms
): number
Get a timeout value from a number or a string
Parameters
Name | Type | Description |
---|---|---|
ms |
string | number |
the timeout value as a number or a string |
Returns
number
The timeout as a number in ms
Implementation of
Inherited from
ITimeoutCommands.parseTimeoutArgument
Defined in
packages/types/build/lib/driver.d.ts:119
proxyActive
▸ proxyActive(sessionId
): boolean
Parameters
Name | Type |
---|---|
sessionId |
string |
Returns
boolean
Implementation of
Inherited from
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
Inherited from
DriverCore.proxyRouteIsAvoided
Defined in
packages/base-driver/lib/basedriver/core.ts:342
reset
▸ reset(): Promise
<void
>
Reset the current session (run the delete session and create session subroutines)
Deprecated
Use explicit session management commands instead
Returns
Promise
<void
>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:195
scriptTimeoutMJSONWP
▸ scriptTimeoutMJSONWP(ms
): Promise
<void
>
Set the script timeout value that was sent in via the JSONWP
Deprecated
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.scriptTimeoutMJSONWP
Defined in
packages/types/build/lib/driver.d.ts:105
scriptTimeoutW3C
▸ scriptTimeoutW3C(ms
): Promise
<void
>
Set the script timeout value that was sent in via the W3C protocol
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
Promise
<void
>
Implementation of
Inherited from
ITimeoutCommands.scriptTimeoutW3C
Defined in
packages/types/build/lib/driver.d.ts:98
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
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:218
setImplicitWait
▸ setImplicitWait(ms
): void
A helper method (not a command) used to set the implicit wait value
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the implicit wait in ms |
Returns
void
Implementation of
Inherited from
ITimeoutCommands.setImplicitWait
Defined in
packages/types/build/lib/driver.d.ts:51
setNewCommandTimeout
▸ setNewCommandTimeout(ms
): void
Set the new command timeout
Parameters
Name | Type | Description |
---|---|---|
ms |
number |
the timeout in ms |
Returns
void
Implementation of
Inherited from
ITimeoutCommands.setNewCommandTimeout
Defined in
packages/types/build/lib/driver.d.ts:36
setProtocolMJSONWP
▸ setProtocolMJSONWP(): void
Returns
void
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:239
setProtocolW3C
▸ setProtocolW3C(): void
Returns
void
Inherited from
Defined in
packages/base-driver/lib/basedriver/core.ts:243
startNewCommandTimeout
▸ startNewCommandTimeout(): Promise
<void
>
Start the timer for the New Command Timeout, which when it runs out, will stop the current session
Returns
Promise
<void
>
Implementation of
Defined in
packages/base-driver/lib/basedriver/driver.ts:163
startUnexpectedShutdown
▸ startUnexpectedShutdown(err?
): Promise
<void
>
Signify to any owning processes that this driver encountered an error which should cause the session to terminate immediately (for example an upstream service failed)
Parameters
Name | Type | Description |
---|---|---|
err |
Error |
the Error object which is causing the shutdown |
Returns
Promise
<void
>
Implementation of
Driver.startUnexpectedShutdown
Defined in
packages/base-driver/lib/basedriver/driver.ts:149
timeouts
▸ timeouts(type
, ms
, script?
, pageLoad?
, implicit?
): Promise
<void
>
Set the various timeouts associated with a session
See
https://w3c.github.io/webdriver/#set-timeouts
Parameters
Name | Type | Description |
---|---|---|
type |
string |
used only for the old (JSONWP) command, the type of the timeout |
ms |
string | number |
used only for the old (JSONWP) command, the ms for the timeout |
script? |
number |
the number in ms for the script timeout, used for the W3C command |
pageLoad? |
number |
the number in ms for the pageLoad timeout, used for the W3C command |
implicit? |
string | number |
the number in ms for the implicit wait timeout, used for the W3C command |
Returns
Promise
<void
>
Implementation of
Inherited from
Defined in
packages/types/build/lib/driver.d.ts:30
updateSettings
▸ updateSettings(newSettings
): Promise
<void
>
Update the session's settings dictionary with a new settings object
Parameters
Name | Type | Description |
---|---|---|
newSettings |
Settings |
A key-value map of setting names to values. Settings not named in the map will not have their value adjusted. |
Returns
Promise
<void
>
Implementation of
Driver.updateSettings
Defined in
packages/base-driver/lib/basedriver/driver.ts:387
validateDesiredCaps
▸ validateDesiredCaps(caps
): caps is DriverCaps<C>
Validate the capabilities used to start a session
Parameters
Name | Type | Description |
---|---|---|
caps |
any |
the capabilities |
Returns
caps is DriverCaps<C>
Whether or not the capabilities are valid
Defined in
packages/base-driver/lib/basedriver/driver.ts:366
validateLocatorStrategy
▸ validateLocatorStrategy(strategy
, webContext?
): void
Parameters
Name | Type | Default value |
---|---|---|
strategy |
string |
undefined |
webContext |
boolean |
false |
Returns
void
Implementation of
Driver.validateLocatorStrategy
Inherited from
DriverCore.validateLocatorStrategy