WebDriver/src/WebDriver/WebDriverGeckodriver.class.st

60 lines
1.4 KiB
Smalltalk

"
I implement the specifics and quirks to remote control a Firefox instance using Geckodriver.
"
Class {
#name : #WebDriverGeckodriver,
#superclass : #WebDriver,
#category : #'WebDriver-Base'
}
{ #category : #testing }
WebDriverGeckodriver class >> matchesBrowserType: browserType [
^ browserType = #Firefox
]
{ #category : #'instance creation' }
WebDriverGeckodriver class >> startWithOptions: options [
| subproc |
subproc := OSSUnixSubprocess new
command: 'geckodriver'.
[ subproc run ] fork.
(Delay forSeconds: 0.1) wait.
^ self new
browser: subproc
server: '127.0.0.1'
port: 4444.
]
{ #category : #'private - utilities' }
WebDriverGeckodriver >> browserDetails [
^ Dictionary new
at: #name put: 'Firefox';
at: #driver put: 'Geckodriver';
yourself.
]
{ #category : #'private - utilities' }
WebDriverGeckodriver >> constructCapabilities: caps [
capabilities := caps.
^ { (#capabilities -> caps) } asDictionary
]
{ #category : #initialization }
WebDriverGeckodriver >> initialize [
]
{ #category : #'private - utilities' }
WebDriverGeckodriver >> postprocessResult: result [
| actualResult |
actualResult := result isDictionary
ifTrue: [
(result includesKey: #value)
ifTrue: [ result at: #value ]
ifFalse: [ result ] ]
ifFalse: [ result ].
^ actualResult
]