45 lines
1019 B
Smalltalk
45 lines
1019 B
Smalltalk
"
|
|
I implement the specifics and quirks to remote control a Firefox instance using Geckodriver.
|
|
"
|
|
Class {
|
|
#name : #WebDriverGeckodriver,
|
|
#superclass : #WebDriver,
|
|
#category : #WebDriver
|
|
}
|
|
|
|
{ #category : #testing }
|
|
WebDriverGeckodriver class >> matchesBrowserType: browserType [
|
|
^ browserType = #Firefox
|
|
]
|
|
|
|
{ #category : #'instance creation' }
|
|
WebDriverGeckodriver class >> startWithOptions: options [
|
|
| subproc |
|
|
subproc := OSSUnixSubprocess new
|
|
command: 'geckodriver'.
|
|
[ subproc run ] fork.
|
|
^ self new
|
|
browser: subproc
|
|
server: '127.0.0.1'
|
|
port: 4444.
|
|
]
|
|
|
|
{ #category : #'private - utilities' }
|
|
WebDriverGeckodriver >> constructCapabilities: caps [
|
|
|
|
^ { #desiredCapabilities
|
|
->
|
|
({ #moz:firefoxOptions -> ({ #prefs -> caps } asDictionary) }
|
|
asDictionary) } asDictionary.
|
|
]
|
|
|
|
{ #category : #initialization }
|
|
WebDriverGeckodriver >> initialize [
|
|
prefs := Dictionary new.
|
|
]
|
|
|
|
{ #category : #'private - utilities' }
|
|
WebDriverGeckodriver >> postprocessResult: result [
|
|
^ result at: #value.
|
|
]
|